🥅 refactor: Express App default Error Handling with ErrorController (#8249)

This commit is contained in:
Sebastien Bruel 2025-07-05 00:51:46 +09:00 committed by Danny Avila
parent 4285d5841c
commit 458580ec87
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956
5 changed files with 281 additions and 9 deletions

View file

@ -55,7 +55,6 @@ const startServer = async () => {
/* Middleware */
app.use(noIndex);
app.use(errorController);
app.use(express.json({ limit: '3mb' }));
app.use(express.urlencoded({ extended: true, limit: '3mb' }));
app.use(mongoSanitize());
@ -121,6 +120,9 @@ const startServer = async () => {
app.use('/api/tags', routes.tags);
app.use('/api/mcp', routes.mcp);
// Add the error controller one more time after all routes
app.use(errorController);
app.use((req, res) => {
res.set({
'Cache-Control': process.env.INDEX_CACHE_CONTROL || 'no-cache, no-store, must-revalidate',