1
0
mirror of https://github.com/ilri/dspace-statistics-api.git synced 2025-05-20 11:23:28 +02:00

Adjust docs at root

Don't use a static HTML file anymore. Now I simply print an XHTML
page from the Falcon resource. This way I can use variables to add
in the API version as well as a link to the Swagger UI.

The list of API calls is still present on the README.md, though in
the long run I might move them to some dedicated documentation or
a GitHub wiki.
This commit is contained in:
2020-12-23 16:12:50 +02:00
parent be83514de1
commit d1229c2387
2 changed files with 15 additions and 46 deletions
dspace_statistics_api

@ -14,8 +14,21 @@ 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()
docs_html = (
"<!DOCTYPE html>"
"<html lang=\"en-US\">"
" <head>"
" <meta charset=\"UTF-8\">"
" <title>DSpace Statistics API</title>"
" </head>"
" <body>"
f" <h1>DSpace Statistics API {VERSION}</h1>"
f" <p>This site is running the <a href=\"https://github.com/ilri/dspace-statistics-api\" title=\"DSpace Statistics API project\">DSpace Statistics API</a>. For more information see the project's README.md or the interactive <a href=\"{DSPACE_STATISTICS_API_URL + '/swagger'}\">Swagger UI</a> built into this API.</p>"
" </body>"
"</html"
)
resp.body = docs_html
class StatusResource: