landing¶
OPTIMADE landing page, rendered as a Jinja2 template.
landing(request)
async
¶
Show a human-readable landing page when the base URL is accessed.
Source code in optimade/server/routers/landing.py
async def landing(request: Request):
""" Show a human-readable landing page when the base URL is accessed. """
meta = meta_values(request.url, 1, 1, more_data_available=False)
major_version = __api_version__.split(".")[0]
versioned_url = f"{get_base_url(request.url)}/v{major_version}/"
context = {
"request": request,
"request_url": request.url,
"api_version": __api_version__,
"implementation": meta.implementation,
"versioned_url": versioned_url,
"provider": meta.provider,
"index_base_url": CONFIG.index_base_url,
"endpoints": list(ENTRY_COLLECTIONS.keys()) + ["info"],
}
return TEMPLATES.TemplateResponse("landing_page.html", context)