Skip to content

Commit 0116cb3

Browse files
committed
fix(server): fix configuration so that (express) errorHandler works
The error handler needs to be below app.use(app.router), otherwise it's never used.
1 parent 5841440 commit 0116cb3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

templates/express/config/express.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,12 @@ module.exports = function(app) {
6060
app.use(passport.initialize());
6161
app.use(passport.session());
6262
<% } %>
63-
// Router needs to be last
63+
// Router (only error handlers should come after this)
6464
app.use(app.router);
65+
66+
// Error handler
67+
if('development' === app.get('env')) {
68+
app.use(express.errorHandler())
69+
}
6570
});
6671
};

0 commit comments

Comments
 (0)