Add 404 and 500 routes

This commit is contained in:
perryharlock
2013-09-24 15:24:54 +01:00
parent d477f66146
commit eb7f7205f9
2 changed files with 14 additions and 7 deletions

7
app.js
View File

@@ -56,10 +56,15 @@ function initApp (config, callback) {
require('./route/task')(app);
// Error handling
app.express.get('*', function (req, res) {
res.status(404);
res.render('404');
});
app.express.use(function (err, req, res, next) {
/* jshint unused: false */
app.emit('route-error', err);
res.send('Error');
res.status(500);
res.render('500');
});
app.server.listen(config.port, function (err) {