INNER CODE UNIT · Python
lifespan
Tisha-runwal/Personalized-Federated-Learning-for-Privacy--Preserving-and-Scalable-IoT-Driven-Smart-Healthcare · server/main.py:17
async def lifespan(app: FastAPI):
"""Initialise the database on startup."""
await init_db()
yield
app = FastAPI(
title="PFL-HCare API",
description="Backend for the Personalized Federated Learning Healthcare dashboard.",
version="0.1.0",
lifespan=lifespan,
)
# ---------------------------------------------------------------------------
# CORS — allow the Vite dev-server and any CRA dev-server
# ---------------------------------------------------------------------------
app.add_middleware(
CORSMiddleware,