Spaces:
Running
Running
Update server.js
Browse files
server.js
CHANGED
|
@@ -215,9 +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 |
-
// In Express 5,
|
| 219 |
-
// Using '
|
| 220 |
-
app.get('
|
| 221 |
if (req.path.startsWith('/api')) {
|
| 222 |
return res.status(404).json({ error: 'API endpoint not found' });
|
| 223 |
}
|
|
|
|
| 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, wildcard parameters must be named.
|
| 219 |
+
// Using '/:path*' satisfies path-to-regexp v8 requirements for catch-all routing.
|
| 220 |
+
app.get('/:path*', (req, res) => {
|
| 221 |
if (req.path.startsWith('/api')) {
|
| 222 |
return res.status(404).json({ error: 'API endpoint not found' });
|
| 223 |
}
|