Files
sdb2-backend/app/main.py

27 lines
470 B
Python

from collections.abc import AsyncGenerator
from contextlib import asynccontextmanager
from fastapi import FastAPI
from app.core.database import init_db
@asynccontextmanager
async def lifespan(_app: FastAPI) -> AsyncGenerator[None, None]:
await init_db()
yield
def create_app() -> FastAPI:
app = FastAPI(lifespan=lifespan)
@app.get("/")
def health() -> dict[str, str]:
return {"status": "healthy"}
return app
app = create_app()