rebuild(stage-1): establish isolated application skeleton
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user