Why: - Wires the ADR-0008 error envelope, per-request correlation id, and the /v1/files routes into the app. Changes: - Extend AppResources/lifespan with the ingestion CapacityLimiter and ObjectStorage adapter. Impact: - /v1 now exposes routes for the first time.
21 lines
644 B
Python
21 lines
644 B
Python
from fastapi import FastAPI
|
|
|
|
from src.api.errors import register_exception_handlers
|
|
from src.api.middleware import RequestIdMiddleware
|
|
from src.api.router import router as v1_router
|
|
from src.api.routers.health import router as health_router
|
|
from src.bootstrap.lifespan import create_lifespan
|
|
from src.config import Settings
|
|
|
|
|
|
def create_app(settings: Settings | None = None) -> FastAPI:
|
|
app = FastAPI(lifespan=create_lifespan(settings))
|
|
app.add_middleware(RequestIdMiddleware)
|
|
register_exception_handlers(app)
|
|
app.include_router(health_router)
|
|
app.include_router(v1_router, prefix="/v1")
|
|
return app
|
|
|
|
|
|
app = create_app()
|