from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from app.config import settings from app.api.v1 import query, export app = FastAPI( title="KOL Insight API", description="KOL 视频数据查询与分析 API", version="1.0.0", ) # CORS 配置 app.add_middleware( CORSMiddleware, allow_origins=settings.CORS_ORIGINS, allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) # 注册 API 路由 app.include_router(query.router, prefix="/api/v1", tags=["Query"]) app.include_router(export.router, prefix="/api/v1", tags=["Export"]) @app.get("/") async def root(): """Root endpoint.""" return {"message": "KOL Insight API", "version": "1.0.0"} @app.get("/health") async def health(): """Health check endpoint.""" return {"status": "healthy"}