Skip to content

Commit

Permalink
Tidy landing page router
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Feb 7, 2020
1 parent fa77e17 commit 8d62654
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion optimade/server/routers/landing.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,19 @@ async def landing(request):

meta = meta_values(str(request.url), 1, 1, more_data_available=False)

major_version = __api_version__.split(".")[0]
versioned_url = (
f"{request.url}"
if f"v{major_version}" in f"{request.url.path}"
else f"{request.url}v{major_version}/"
)

context = {
"request": request,
"request_url": request.url,
"api_version": __api_version__,
"versioned_url": str(request.url) + meta.api_version + "/",
"implementation": meta.implementation,
"versioned_url": versioned_url,
"provider": meta.provider,
"endpoints": list(ENTRY_COLLECTIONS.keys()) + ["info"],
}
Expand Down

0 comments on commit 8d62654

Please sign in to comment.