Fix: Resolve route conflict - move root JSON endpoint to /api
The root / endpoint in main.py was conflicting with the HTML endpoint in auth.router, causing the homepage to return JSON instead of rendering the HTML dashboard. Moved API info to /api to allow auth.router to properly handle / and /login pages.
This commit is contained in:
@@ -313,14 +313,14 @@ async def health_check() -> Dict[str, Any]:
|
|||||||
"database_status": db_status
|
"database_status": db_status
|
||||||
}
|
}
|
||||||
|
|
||||||
# Include routers
|
# Include routers - auth.router handles / and /login HTML pages
|
||||||
app.include_router(auth.router, prefix="/auth", tags=["Auth"])
|
app.include_router(auth.router, prefix="/auth", tags=["Auth"])
|
||||||
app.include_router(auth.router, prefix="", tags=["Auth"])
|
app.include_router(auth.router, prefix="", tags=["Auth"])
|
||||||
|
|
||||||
# Root endpoint
|
# API info endpoint (moved from / to /api to avoid conflict with auth.router)
|
||||||
@app.get("/", tags=["Root"])
|
@app.get("/api", tags=["API Info"])
|
||||||
async def root() -> Dict[str, Any]:
|
async def api_info() -> Dict[str, Any]:
|
||||||
"""Root endpoint with API information"""
|
"""API information endpoint"""
|
||||||
return {
|
return {
|
||||||
"message": AppConfig.APP_NAME,
|
"message": AppConfig.APP_NAME,
|
||||||
"version": AppConfig.VERSION,
|
"version": AppConfig.VERSION,
|
||||||
|
|||||||
Reference in New Issue
Block a user