feat: enhance API error handling and improve alert message formatting

This commit is contained in:
SaelixCode
2026-02-27 12:22:10 -05:00
parent 91cafb49f9
commit f4700ebfc9
3 changed files with 39 additions and 3 deletions
+9
View File
@@ -828,6 +828,15 @@ if (process.env.NODE_ENV === 'production') {
app.use((req: Request, res: Response) => {
if (!req.path.startsWith('/api')) {
res.sendFile('index.html', { root: 'public' });
} else {
res.status(404).json({ error: 'API endpoint not found' });
}
});
} else {
// In development, still need to catch 404s for API to prevent hangs
app.use((req: Request, res: Response) => {
if (req.path.startsWith('/api')) {
res.status(404).json({ error: 'API endpoint not found' });
}
});
}