Spaces:
Running
Running
Upload index.js
Browse files- server/index.js +6 -1
server/index.js
CHANGED
|
@@ -121,7 +121,12 @@ if (process.env.NODE_ENV === 'production') {
|
|
| 121 |
app.get('*', (req, res) => {
|
| 122 |
// Don't serve the React app for API routes or health check
|
| 123 |
if (req.path.startsWith('/api/') || req.path === '/health') {
|
| 124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
}
|
| 126 |
|
| 127 |
// Serve the React app for all other routes
|
|
|
|
| 121 |
app.get('*', (req, res) => {
|
| 122 |
// Don't serve the React app for API routes or health check
|
| 123 |
if (req.path.startsWith('/api/') || req.path === '/health') {
|
| 124 |
+
// For API routes that don't exist, return 404
|
| 125 |
+
if (req.path.startsWith('/api/')) {
|
| 126 |
+
return res.status(404).json({ error: 'API endpoint not found' });
|
| 127 |
+
}
|
| 128 |
+
// For health check, it's already handled above
|
| 129 |
+
return res.status(404).json({ error: 'Not found' });
|
| 130 |
}
|
| 131 |
|
| 132 |
// Serve the React app for all other routes
|