← back to Travis
add 404 fallback middleware after static + routes
4a87b4b4a528ece6d554247f102e7994bd95b4b5 · 2026-05-19 21:26:57 -0700 · Steve Abrams
Returns JSON {error:'not_found', path} instead of silent Express default
HTML 404 — easier to debug from logs and consistent with the rest of
the JSON API.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Files touched
Diff
commit 4a87b4b4a528ece6d554247f102e7994bd95b4b5
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Tue May 19 21:26:57 2026 -0700
add 404 fallback middleware after static + routes
Returns JSON {error:'not_found', path} instead of silent Express default
HTML 404 — easier to debug from logs and consistent with the rest of
the JSON API.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---
server.js | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/server.js b/server.js
index a61bafb..56bf5d7 100644
--- a/server.js
+++ b/server.js
@@ -86,6 +86,11 @@ app.get('/health', (req, res) => {
res.json({ status: 'ok', agent: 'Travis', role: 'Stereo Report' });
});
+// ── 404 fallback (after static + routes) ──
+app.use((req, res) => {
+ res.status(404).json({ error: 'not_found', path: req.path });
+});
+
app.listen(PORT, '0.0.0.0', () => {
console.log(`Travis — Stereo Report live on port ${PORT}`);
});
← 4a78ac4 broaden .gitignore to cover all snapshot-file patterns
·
back to Travis
·
SECURITY: remove stereo-data.csv (was publicly exposed unaut 3901827 →