Fix: Improve routing logic to prevent 404s on custom domains
Browse files- backend/server.js +4 -5
backend/server.js
CHANGED
|
@@ -133,11 +133,10 @@ 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 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
next();
|
| 141 |
});
|
| 142 |
|
| 143 |
app.get('/api/status/sentinel-history', (req, res) => {
|
|
|
|
| 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 should come AFTER specific API/Static routes
|
| 137 |
+
app.get('*', (req, res, next) => {
|
| 138 |
+
if (req.path.startsWith('/api')) return next();
|
| 139 |
+
res.sendFile(path.join(__dirname, 'public', 'index.html'));
|
|
|
|
| 140 |
});
|
| 141 |
|
| 142 |
app.get('/api/status/sentinel-history', (req, res) => {
|