20 lines
631 B
Python
20 lines
631 B
Python
from fastapi import FastAPI
|
|
|
|
from backend.bootstrap.settings import Settings
|
|
from backend.http.errors import install_error_handlers
|
|
from backend.http.router import api_router
|
|
|
|
|
|
def create_application(settings: Settings | None = None) -> FastAPI:
|
|
runtime = settings or Settings.from_environment()
|
|
application = FastAPI(
|
|
title="小白复盘",
|
|
version="0.1.0",
|
|
docs_url="/api/docs" if runtime.debug else None,
|
|
redoc_url=None,
|
|
)
|
|
application.state.settings = runtime
|
|
install_error_handlers(application)
|
|
application.include_router(api_router, prefix="/api")
|
|
return application
|