Spaces:
Sleeping
Sleeping
Update server.js
Browse files
server.js
CHANGED
|
@@ -215,7 +215,9 @@ app.get(`${CITI_BASE}/accounts/:accountId/transactions`, (req, res) => {
|
|
| 215 |
app.use(express.static(path.join(__dirname, 'dist')));
|
| 216 |
|
| 217 |
// SPA Fallback: Redirect all non-API requests to index.html
|
| 218 |
-
|
|
|
|
|
|
|
| 219 |
if (req.path.startsWith('/api')) {
|
| 220 |
return res.status(404).json({ error: 'API endpoint not found' });
|
| 221 |
}
|
|
|
|
| 215 |
app.use(express.static(path.join(__dirname, 'dist')));
|
| 216 |
|
| 217 |
// SPA Fallback: Redirect all non-API requests to index.html
|
| 218 |
+
// In Express 5, the unnamed wildcard '*' is no longer supported.
|
| 219 |
+
// Using '/*' ensures all sub-routes are captured for the frontend router.
|
| 220 |
+
app.get('/*', (req, res) => {
|
| 221 |
if (req.path.startsWith('/api')) {
|
| 222 |
return res.status(404).json({ error: 'API endpoint not found' });
|
| 223 |
}
|