diff --git a/src/leapfrogai_api/main.py b/src/leapfrogai_api/main.py index 00140a8e3..9631aeb01 100644 --- a/src/leapfrogai_api/main.py +++ b/src/leapfrogai_api/main.py @@ -8,6 +8,7 @@ from fastapi import FastAPI from fastapi.exception_handlers import request_validation_exception_handler from fastapi.exceptions import RequestValidationError +from fastapi.responses import RedirectResponse from leapfrogai_api.routers.base import router as base_router from leapfrogai_api.routers.leapfrogai import auth from leapfrogai_api.routers.leapfrogai import models as lfai_models @@ -60,6 +61,13 @@ async def lifespan(app: FastAPI): app = FastAPI(lifespan=lifespan) + +@app.get("") +async def root(): + """Intercepts the root path and redirects to the API documentation.""" + return RedirectResponse(url="/redoc") + + Instrumentator( excluded_handlers=["/healthz", "/metrics"], should_group_status_codes=False, diff --git a/src/leapfrogai_api/routers/base.py b/src/leapfrogai_api/routers/base.py index 95951eb50..3b3f6d071 100644 --- a/src/leapfrogai_api/routers/base.py +++ b/src/leapfrogai_api/routers/base.py @@ -1,18 +1,10 @@ """Base router for the API.""" from fastapi import APIRouter -from fastapi.responses import RedirectResponse - router = APIRouter(tags=["/"]) -@router.get("") -async def root(): - """Intercepts the root path and redirects to the API documentation.""" - return RedirectResponse(url="/redoc") - - @router.get("/healthz") async def healthz(): """Health check endpoint."""