fix: separate root and /web route handlers in server/app.py
Browse files- server/app.py +10 -0
server/app.py
CHANGED
|
@@ -53,6 +53,16 @@ def _load_dashboard() -> str:
|
|
| 53 |
|
| 54 |
|
| 55 |
@app.get("/", response_class=HTMLResponse)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
@app.get("/web", response_class=HTMLResponse)
|
| 57 |
def web_interface():
|
| 58 |
try:
|
|
|
|
| 53 |
|
| 54 |
|
| 55 |
@app.get("/", response_class=HTMLResponse)
|
| 56 |
+
def root_interface():
|
| 57 |
+
try:
|
| 58 |
+
return HTMLResponse(content=_load_dashboard())
|
| 59 |
+
except FileNotFoundError as e:
|
| 60 |
+
return HTMLResponse(
|
| 61 |
+
content=f"<h2>Dashboard not found</h2><p>{e}</p>",
|
| 62 |
+
status_code=404
|
| 63 |
+
)
|
| 64 |
+
|
| 65 |
+
|
| 66 |
@app.get("/web", response_class=HTMLResponse)
|
| 67 |
def web_interface():
|
| 68 |
try:
|