From a3b609eab735994551668c7f3ade404a85e6e23c Mon Sep 17 00:00:00 2001 From: richardtekula Date: Tue, 11 Nov 2025 16:57:38 +0100 Subject: [PATCH] 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. --- ebook_backend&admin_panel/admin-backend/main.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ebook_backend&admin_panel/admin-backend/main.py b/ebook_backend&admin_panel/admin-backend/main.py index 9c2d2b2..d7e459a 100644 --- a/ebook_backend&admin_panel/admin-backend/main.py +++ b/ebook_backend&admin_panel/admin-backend/main.py @@ -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,