Spaces:
Sleeping
Sleeping
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from app.core.config import settings | |
| from app.core.logging_config import setup_logging | |
| from app.api.v1.router import api_router | |
| from app.core.exceptions import setup_exception_handlers | |
| from app.core.startup import startup_event, shutdown_event | |
| setup_logging() | |
| app = FastAPI( | |
| title=settings.APP_NAME, | |
| version=settings.APP_VERSION, | |
| description=settings.APP_DESCRIPTION | |
| ) | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=settings.ALLOWED_ORIGINS, | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| setup_exception_handlers(app) | |
| app.include_router(api_router, prefix="/api/v1") | |
| async def startup(): | |
| await startup_event(app) | |
| async def shutdown(): | |
| await shutdown_event(app) | |
| async def root(): | |
| return {"status": "healthy", "service": settings.APP_NAME} | |
| async def health_check(): | |
| return {"status": "healthy"} | |