dingdanquanliucheng/backend/app/main.py
2026-05-14 10:15:51 +08:00

23 lines
648 B
Python

from fastapi import FastAPI
from backend.app.api.v1.router import api_router
from backend.app.core.config import settings
from backend.app.core.exceptions import register_exception_handlers
from backend.app.core.logging import setup_logging
def create_app() -> FastAPI:
setup_logging()
app = FastAPI(title=settings.app_name, version=settings.app_version, debug=settings.debug)
register_exception_handlers(app)
app.include_router(api_router, prefix=settings.api_prefix)
@app.get("/health", summary="健康检查")
def health_check() -> dict[str, str]:
return {"status": "ok"}
return app
app = create_app()