zhlajiex commited on
Commit
d0929e4
·
1 Parent(s): 64eb025

Fix: Use regex for catch-all route to ensure Express 5 compatibility

Browse files
Files changed (1) hide show
  1. 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 should come AFTER specific API/Static routes
137
- app.get('/:path*', (req, res, next) => {
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