diff --git a/dspace_statistics_api/app.py b/dspace_statistics_api/app.py index e0eb8b5..4cc6e27 100644 --- a/dspace_statistics_api/app.py +++ b/dspace_statistics_api/app.py @@ -4,6 +4,13 @@ import falcon db = database_connection() db.set_session(readonly=True) +class RootResource: + def on_get(self, req, resp): + resp.status = falcon.HTTP_200 + resp.content_type = 'text/html' + with open('dspace_statistics_api/docs/index.html', 'r') as f: + resp.body = f.read() + class AllItemsResource: def on_get(self, req, resp): """Handles GET requests""" @@ -64,6 +71,7 @@ class ItemResource: cursor.close() api = application = falcon.API() +api.add_route('/', RootResource()) api.add_route('/items', AllItemsResource()) api.add_route('/item/{item_id:int}', ItemResource()) diff --git a/dspace_statistics_api/docs/index.html b/dspace_statistics_api/docs/index.html new file mode 100644 index 0000000..2b41931 --- /dev/null +++ b/dspace_statistics_api/docs/index.html @@ -0,0 +1,17 @@ + + + + + DSpace Statistics API + + +

DSpace Statistics API

+

This site is running the DSpace Statistics API. The following endpoints are available:

+ +

¹ The API is querying the Solr statistics core, which technically only knows about items that have either views or downloads.

+ +