Kashish commited on
Commit ·
c8f9252
1
Parent(s): 10260a6
Fixed Fastapi route error
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
from fastapi import FastAPI
|
|
|
|
| 2 |
from contextlib import asynccontextmanager
|
| 3 |
from dotenv import load_dotenv
|
| 4 |
|
|
@@ -6,12 +7,10 @@ load_dotenv()
|
|
| 6 |
|
| 7 |
from routers.content import router as content_router
|
| 8 |
|
| 9 |
-
|
| 10 |
@asynccontextmanager
|
| 11 |
async def lifespan(app: FastAPI):
|
| 12 |
yield
|
| 13 |
|
| 14 |
-
|
| 15 |
app = FastAPI(
|
| 16 |
title="Pet Parenting Tips & Blogs Generation API",
|
| 17 |
description="AI-powered daily pet parenting tips and blog generation.",
|
|
@@ -21,6 +20,10 @@ app = FastAPI(
|
|
| 21 |
|
| 22 |
app.include_router(content_router)
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
@app.get("/health", tags=["meta"])
|
| 25 |
async def health_check() -> dict:
|
| 26 |
return {"status": "ok"}
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
+
from fastapi.responses import RedirectResponse
|
| 3 |
from contextlib import asynccontextmanager
|
| 4 |
from dotenv import load_dotenv
|
| 5 |
|
|
|
|
| 7 |
|
| 8 |
from routers.content import router as content_router
|
| 9 |
|
|
|
|
| 10 |
@asynccontextmanager
|
| 11 |
async def lifespan(app: FastAPI):
|
| 12 |
yield
|
| 13 |
|
|
|
|
| 14 |
app = FastAPI(
|
| 15 |
title="Pet Parenting Tips & Blogs Generation API",
|
| 16 |
description="AI-powered daily pet parenting tips and blog generation.",
|
|
|
|
| 20 |
|
| 21 |
app.include_router(content_router)
|
| 22 |
|
| 23 |
+
@app.get("/", include_in_schema=False)
|
| 24 |
+
async def root():
|
| 25 |
+
return RedirectResponse(url="/docs")
|
| 26 |
+
|
| 27 |
@app.get("/health", tags=["meta"])
|
| 28 |
async def health_check() -> dict:
|
| 29 |
return {"status": "ok"}
|