Initial commit: ICU Patient Display Management System
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from app.core.config import settings
|
||||
from app.controllers import auth, patient, display, room, vitals
|
||||
from app.core.database import engine
|
||||
from app.models.base import Base
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
# Create SQLite tables on startup automatically
|
||||
async with engine.begin() as conn:
|
||||
await conn.run_sync(Base.metadata.create_all)
|
||||
yield
|
||||
|
||||
app = FastAPI(
|
||||
title="ICU Patient Display Management System API",
|
||||
description="Backend API for managing ICU patients and ESP32 displays",
|
||||
version="1.0.0",
|
||||
lifespan=lifespan
|
||||
)
|
||||
|
||||
# CORS Middleware configuration
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=["*"],
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
app.include_router(auth.router)
|
||||
app.include_router(patient.router)
|
||||
app.include_router(display.router)
|
||||
app.include_router(room.router)
|
||||
app.include_router(vitals.router)
|
||||
|
||||
@app.get("/")
|
||||
async def root():
|
||||
return {"message": "Welcome to ICU Patient Display API"}
|
||||
Reference in New Issue
Block a user