diff --git a/src/labs/api.py b/src/labs/api.py index b830a9e..50697de 100644 --- a/src/labs/api.py +++ b/src/labs/api.py @@ -16,7 +16,7 @@ from fastapi.responses import JSONResponse from fastapi.routing import APIRoute -from .routers import router_auth, router_ext, router_users +from .routers import router_root api_description = """ This project provides a reference Python API built using FastAPI, the @@ -56,10 +56,7 @@ ) # Additional routers of the application described in the routers package -app.include_router(router_auth) -app.include_router(router_ext, prefix="/ext") -app.include_router(router_users, prefix="/users") - +app.include_router(router_root) @app.get("/") async def root(request: Request): diff --git a/src/labs/routers/__init__.py b/src/labs/routers/__init__.py index 0fac006..9308b0e 100644 --- a/src/labs/routers/__init__.py +++ b/src/labs/routers/__init__.py @@ -6,6 +6,24 @@ """ +from fastapi import APIRouter + from .auth import router as router_auth from .ext import router as router_ext -from .users import router as router_users \ No newline at end of file +from .users import router as router_users + +# Mount all routers at the top level +# this is what the FastAPI app will use +router_root = APIRouter() + +router_root.include_router( + router_auth, +) +router_root.include_router( + router_ext, + prefix="/ext", +) +router_root.include_router( + router_users, + prefix="/users", +)