Spaces:
Runtime error
Runtime error
Ved Gupta
commited on
Commit
·
da96f77
1
Parent(s):
84ee91f
redirect response added / to /docs
Browse files- app/main.py +6 -0
app/main.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
from fastapi import FastAPI
|
2 |
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
|
3 |
|
4 |
from app.api import api_router
|
5 |
from app.core.config import settings
|
@@ -27,6 +29,10 @@ if settings.BACKEND_CORS_ORIGINS:
|
|
27 |
allow_headers=["*"],
|
28 |
)
|
29 |
|
|
|
|
|
|
|
|
|
30 |
|
31 |
@app.get("/ping", tags=["ping"], response_model=PingResponse)
|
32 |
async def ping():
|
|
|
1 |
from fastapi import FastAPI
|
2 |
from fastapi.middleware.cors import CORSMiddleware
|
3 |
+
from fastapi.responses import RedirectResponse
|
4 |
+
|
5 |
|
6 |
from app.api import api_router
|
7 |
from app.core.config import settings
|
|
|
29 |
allow_headers=["*"],
|
30 |
)
|
31 |
|
32 |
+
@app.get("/", include_in_schema=False)
|
33 |
+
async def redirect_to_docs():
|
34 |
+
return RedirectResponse(url="/docs")
|
35 |
+
|
36 |
|
37 |
@app.get("/ping", tags=["ping"], response_model=PingResponse)
|
38 |
async def ping():
|