fix(api): improve 404 handling for unknown API routes

- Refactored the 404 response for API routes to ensure it only triggers for paths starting with '/api/', enhancing clarity in error handling.
- Updated package dependencies in package.json and package-lock.json to maintain version consistency and address potential vulnerabilities.
This commit is contained in:
Torsten Schulz (local)
2026-03-27 09:52:24 +01:00
parent 21072139f7
commit e13deb0720
3 changed files with 1652 additions and 360 deletions

View File

@@ -129,6 +129,11 @@ app.get(/^\/(?!api\/).*/, (req, res) => {
});
// Fallback 404 for unknown API routes
app.use('/api/*', (req, res) => res.status(404).send('404 Not Found'));
app.use((req, res, next) => {
if (req.path.startsWith('/api/')) {
return res.status(404).send('404 Not Found');
}
return next();
});
export default app;