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;

1997
backend/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -21,6 +21,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@gltf-transform/cli": "^3.5.1",
"amqplib": "^0.10.9",
"bcryptjs": "^3.0.3",
"connect-redis": "^9.0.0",
@@ -43,10 +44,9 @@
"sharp": "^0.34.5",
"socket.io": "^4.8.3",
"uuid": "^13.0.0",
"ws": "^8.20.0",
"@gltf-transform/cli": "^4.3.0"
"ws": "^8.20.0"
},
"devDependencies": {
"sequelize-cli": "^6.6.5"
"sequelize-cli": "^6.6.2"
}
}