From 15c6d258137464aad5bbcc53f6044ad628849048 Mon Sep 17 00:00:00 2001
From: Matthias Nott <mnott@mnsoft.org>
Date: Sat, 21 Feb 2026 10:36:55 +0100
Subject: [PATCH] fix: trailing slash routes, static file serving
---
app/main.py | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/app/main.py b/app/main.py
index 7088a4b..5a6e260 100644
--- a/app/main.py
+++ b/app/main.py
@@ -51,10 +51,11 @@
app.include_router(system.router, prefix="/api/system", tags=["system"])
# ---------------------------------------------------------------------------
-# Static files – serve the frontend SPA at /
-# Mount last so API routes take precedence
+# Static files – serve CSS/JS at /static and HTML at /
+# Mount /static first for explicit asset paths, then / for SPA fallback
# ---------------------------------------------------------------------------
if _STATIC_DIR.exists():
+ app.mount("/static", StaticFiles(directory=str(_STATIC_DIR)), name="static-assets")
app.mount("/", StaticFiles(directory=str(_STATIC_DIR), html=True), name="static")
else:
logger.warning("Static directory not found at %s – frontend will not be served", _STATIC_DIR)
--
Gitblit v1.3.1