feat: add CORS support, public JS SDK, and live Render vitals forwarding
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user