39 lines
914 B
Python
39 lines
914 B
Python
from fastapi import FastAPI
|
|
|
|
from app.core.config import get_settings
|
|
from app.api.v1.reco import router as reco_router
|
|
from app.api.v1.user_profile_scoring import router as user_profile_router
|
|
|
|
|
|
def create_app() -> FastAPI:
|
|
"""
|
|
创建 FastAPI 应用实例。
|
|
|
|
说明:目前仅提供最小可运行骨架(健康检查),后续逐步加入路由与中间件。
|
|
"""
|
|
|
|
settings = get_settings()
|
|
|
|
app = FastAPI(title=settings.app_name)
|
|
|
|
# 业务路由
|
|
app.include_router(user_profile_router)
|
|
app.include_router(reco_router)
|
|
|
|
@app.get("/health")
|
|
async def health() -> dict:
|
|
"""
|
|
部署健康检查(兼容常见探针路径)。
|
|
"""
|
|
return {"status": "ok", "env": settings.app_env}
|
|
|
|
@app.get("/healthz")
|
|
async def healthz() -> dict:
|
|
return {"status": "ok", "env": settings.app_env}
|
|
|
|
return app
|
|
|
|
|
|
app = create_app()
|
|
|