from contextlib import asynccontextmanager from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from app.api.v1.router import api_router from app.core.config import settings @asynccontextmanager async def lifespan(app: FastAPI): yield app = FastAPI( title=settings.APP_TITLE, version=settings.APP_VERSION, lifespan=lifespan, ) app.add_middleware( CORSMiddleware, allow_origins=settings.CORS_ORIGINS, allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) app.include_router(api_router) @app.get("/health", tags=["System"]) async def health_check(): return {"status": "ok", "version": settings.APP_VERSION}