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:
@@ -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;
|
||||
|
||||
1999
backend/package-lock.json
generated
1999
backend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user