from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from app.routes.items import router as items_router app = FastAPI( title="FastAPI 示例应用", description="一个使用uv管理的FastAPI示例应用", version="0.1.0" ) app.add_middleware( CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) app.include_router(items_router, prefix="/api/v1") @app.get("/") def read_root(): return {"message": "欢迎使用FastAPI示例应用 v1.2"} @app.get("/health") def health_check(): return {"status": "healthy"}