From a4107d097699b644f489be1403ff8e046a3af62a Mon Sep 17 00:00:00 2001 From: Parker Date: Fri, 31 May 2024 01:29:25 -0500 Subject: [PATCH] Redirect `/` -> `/docs` --- app/routes.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/routes.py b/app/routes.py index da8a502..fa5ab57 100644 --- a/app/routes.py +++ b/app/routes.py @@ -1,5 +1,6 @@ import fastapi from fastapi import Security, HTTPException, Request +from starlette.responses import RedirectResponse import pydantic import sqlalchemy @@ -191,4 +192,10 @@ async def link_delrecords(link: str, api_key: str = Security(check_api_key)): detail="Link not associated with given API key" ) else: - return {"link": f"The records for link {data} have been deleted"} \ No newline at end of file + return {"link": f"The records for link {data} have been deleted"} + + +# Redirect / -> /docs +@app.get("/", summary="Redirect to the Swagger UI documentation") +async def redirect_to_docs(): + return RedirectResponse(url="/docs") \ No newline at end of file