Fix Dashboard: Remove root conflict and handle SPA routing at /
Browse files
app.py
CHANGED
|
@@ -193,15 +193,7 @@ async def http_exception_handler(request, exc):
|
|
| 193 |
|
| 194 |
# ββ Endpoints βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 195 |
|
| 196 |
-
|
| 197 |
-
def root():
|
| 198 |
-
"""Absolute root ping handler for infrastructure readiness checks."""
|
| 199 |
-
return {
|
| 200 |
-
"status": "ready",
|
| 201 |
-
"message": "CodeLens API is operational.",
|
| 202 |
-
"docs": "/docs",
|
| 203 |
-
"health": "/health"
|
| 204 |
-
}
|
| 205 |
|
| 206 |
@app.get("/health")
|
| 207 |
def health_check():
|
|
@@ -377,8 +369,10 @@ static_dir = os.path.join(os.path.dirname(__file__), "static", "dashboard")
|
|
| 377 |
if os.path.exists(static_dir):
|
| 378 |
app.mount("/dashboard/assets", StaticFiles(directory=os.path.join(static_dir, "assets")), name="dashboard-assets")
|
| 379 |
|
|
|
|
| 380 |
@app.get("/dashboard", include_in_schema=False)
|
| 381 |
@app.get("/dashboard/{full_path:path}", include_in_schema=False)
|
|
|
|
| 382 |
def dashboard(full_path: str = ""):
|
| 383 |
"""Serve the React dashboard SPA (index.html for all sub-paths)."""
|
| 384 |
# 1. Check if the requested full_path is a specific static file (e.g. logo.svg)
|
|
|
|
| 193 |
|
| 194 |
# ββ Endpoints βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 195 |
|
| 196 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
|
| 198 |
@app.get("/health")
|
| 199 |
def health_check():
|
|
|
|
| 369 |
if os.path.exists(static_dir):
|
| 370 |
app.mount("/dashboard/assets", StaticFiles(directory=os.path.join(static_dir, "assets")), name="dashboard-assets")
|
| 371 |
|
| 372 |
+
@app.get("/", include_in_schema=False)
|
| 373 |
@app.get("/dashboard", include_in_schema=False)
|
| 374 |
@app.get("/dashboard/{full_path:path}", include_in_schema=False)
|
| 375 |
+
@app.get("/{full_path:path}", include_in_schema=False)
|
| 376 |
def dashboard(full_path: str = ""):
|
| 377 |
"""Serve the React dashboard SPA (index.html for all sub-paths)."""
|
| 378 |
# 1. Check if the requested full_path is a specific static file (e.g. logo.svg)
|