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
|
||||
}
|
||||
|
||||
# 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="", tags=["Auth"])
|
||||
|
||||
# Root endpoint
|
||||
@app.get("/", tags=["Root"])
|
||||
async def root() -> Dict[str, Any]:
|
||||
"""Root endpoint with API information"""
|
||||
# API info endpoint (moved from / to /api to avoid conflict with auth.router)
|
||||
@app.get("/api", tags=["API Info"])
|
||||
async def api_info() -> Dict[str, Any]:
|
||||
"""API information endpoint"""
|
||||
return {
|
||||
"message": AppConfig.APP_NAME,
|
||||
"version": AppConfig.VERSION,
|
||||
|
||||
Reference in New Issue
Block a user