FAST API – include_router() ?


What Is include_router() ?

from app.api.v1.router import router as api_v1_router
app.include_router(api_v1_router)
"""
API v1 Router

Single place where ALL routes are mounted.
Adding a connector never touches this file — only endpoints/connectors.py
and the schema layer change.
"""

from fastapi import APIRouter

from app.api.v1.endpoints import connectors, health, jobs, sync, retriever

router = APIRouter()

router.include_router(health.router, prefix="/v1", tags=["Health"])
router.include_router(jobs.router, prefix="/v1", tags=["Jobs"])
router.include_router(connectors.router, prefix="/v1", tags=["Connectors"])
router.include_router(sync.router, prefix="/v1", tags=["Sync"])
router.include_router(retriever.router, prefix="/v1", tags=["Retrieval"])

Leave a Reply

Your email address will not be published. Required fields are marked *