Spaces:
Running
Running
File size: 817 Bytes
5208096 ce0b1fc 5208096 ce0b1fc 5208096 ce0b1fc 5208096 ce0b1fc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.api import ecg, streaming, dashboard
from app.db.session import close_engine, init_db
app = FastAPI(title="Sundew Health API", version="0.1.0")
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.on_event("startup")
def on_startup() -> None:
init_db()
@app.on_event("shutdown")
def on_shutdown() -> None:
close_engine()
@app.get("/health", tags=["meta"])
async def health_check() -> dict:
return {"status": "ok"}
app.include_router(ecg.router, prefix="/ecg", tags=["ecg"])
app.include_router(streaming.router, tags=["streaming"])
app.include_router(dashboard.router, prefix="/dashboard", tags=["dashboard"])
|