INNER CODE UNIT · Python
index
gokulapap/Reconator · backend/app/main.py:90
def index() -> FileResponse:
return FileResponse(_index_file)
@app.exception_handler(StarletteHTTPException)
async def spa_fallback(request: Request, exc: StarletteHTTPException):
if (
exc.status_code == 404
and request.method == "GET"
and not request.url.path.startswith(("/api", "/docs", "/openapi", "/redoc"))
):
return FileResponse(_index_file)
return JSONResponse({"detail": exc.detail}, status_code=exc.status_code)
else:
@app.get("/", include_in_schema=False)
def root() -> dict[str, str]:
return {
"name": settings.app_name,