"""FastAPI 应用工厂。""" from fastapi import FastAPI from app.core.config import get_settings from app.core.errors import install_error_handlers def create_app() -> FastAPI: settings = get_settings() app = FastAPI( title="Hunjing API", version="0.1.0", # 公共契约位于 docs/contracts 与 openapi/;本服务 docs 仅供开发调试。 docs_url="/_dev/docs", openapi_url="/_dev/openapi.json", ) install_error_handlers(app) @app.get("/healthz", tags=["ops"]) async def healthz() -> dict[str, str]: return {"status": "ok", "env": settings.env} return app app = create_app()