Skip to content

Commit

Permalink
fix(server): fix configuration so that (express) errorHandler works
Browse files Browse the repository at this point in the history
The error handler needs to be below app.use(app.router), otherwise it's never used.
  • Loading branch information
zfarrell committed Feb 19, 2014
1 parent 5841440 commit 0116cb3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion templates/express/config/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ module.exports = function(app) {
app.use(passport.initialize());
app.use(passport.session());
<% } %>
// Router needs to be last
// Router (only error handlers should come after this)
app.use(app.router);

// Error handler
if('development' === app.get('env')) {
app.use(express.errorHandler())
}
});
};

0 comments on commit 0116cb3

Please sign in to comment.