feat: add CORS support, public JS SDK, and live Render vitals forwarding

This commit is contained in:
2026-07-13 14:59:37 +05:30
parent b92a33d69f
commit c086bf5d27
3 changed files with 311 additions and 23 deletions
+14
View File
@@ -143,9 +143,23 @@ app = FastAPI(
lifespan=lifespan
)
# Enable CORS for cross-origin app integrations (e.g. Electron apps, local dev servers)
from fastapi.middleware.cors import CORSMiddleware
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Include dashboard routes
app.include_router(dashboard.router, prefix="/api")
# Serve static folder
from fastapi.staticfiles import StaticFiles
app.mount("/static", StaticFiles(directory="static"), name="static")
# === WebSocket endpoint for live vitals ===
@app.websocket("/ws/vitals")