rebuild(stage-1): establish isolated application skeleton

This commit is contained in:
leefer
2026-07-30 00:46:43 +08:00
parent 6df26a2545
commit 603e73d128
32 changed files with 2691 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
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