Dentimap / main.py
Harshith Reddy
Fix module conflict: rename app.py to main.py
ea3f5a2
Raw
History Blame Contribute Delete
1.04 kB
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")
@app.on_event("startup")
async def startup():
await startup_event(app)
@app.on_event("shutdown")
async def shutdown():
await shutdown_event(app)
@app.get("/")
async def root():
return {"status": "healthy", "service": settings.APP_NAME}
@app.get("/health")
async def health_check():
return {"status": "healthy"}