Skip to content

Commit

Permalink
move intercepter back to main because errors
Browse files Browse the repository at this point in the history
  • Loading branch information
gphorvath committed Sep 30, 2024
1 parent e85a9fd commit 2aa3126
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 8 additions & 0 deletions src/leapfrogai_api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 0 additions & 8 deletions src/leapfrogai_api/routers/base.py
Original file line number Diff line number Diff line change
@@ -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."""
Expand Down

0 comments on commit 2aa3126

Please sign in to comment.