Fix: Use regex for catch-all route to ensure Express 5 compatibility
Browse files- backend/server.js +2 -3
backend/server.js
CHANGED
|
@@ -133,9 +133,8 @@ app.get('/sentinel', (req, res) => res.sendFile(path.join(__dirname, 'public', '
|
|
| 133 |
app.get('/manifesto', (req, res) => res.sendFile(path.join(__dirname, 'public', 'manifesto.html')));
|
| 134 |
app.get('/broadcast', (req, res) => res.sendFile(path.join(__dirname, 'public', 'broadcast.html')));
|
| 135 |
|
| 136 |
-
// Catch-all for React/Frontend routes
|
| 137 |
-
app.get(
|
| 138 |
-
if (req.path.startsWith('/api')) return next();
|
| 139 |
res.sendFile(path.join(__dirname, 'public', 'index.html'));
|
| 140 |
});
|
| 141 |
|
|
|
|
| 133 |
app.get('/manifesto', (req, res) => res.sendFile(path.join(__dirname, 'public', 'manifesto.html')));
|
| 134 |
app.get('/broadcast', (req, res) => res.sendFile(path.join(__dirname, 'public', 'broadcast.html')));
|
| 135 |
|
| 136 |
+
// Catch-all for React/Frontend routes
|
| 137 |
+
app.get(/^(?!\/api).+/, (req, res) => {
|
|
|
|
| 138 |
res.sendFile(path.join(__dirname, 'public', 'index.html'));
|
| 139 |
});
|
| 140 |
|