aboutsummaryrefslogtreecommitdiff
path: root/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'app.js')
-rw-r--r--app.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/app.js b/app.js
index 476d538..10db51d 100644
--- a/app.js
+++ b/app.js
@@ -68,4 +68,20 @@ app.use('/admin', adminRoutes);
app.use('/user', userRoutes);
app.use('/', routes);
+
+app.use(function(req, res, next){
+ res.status(404 || 500);
+
+ // respond with html page
+ if (req.accepts('html')) {
+ res.render('error', { url: req.url });
+ return;
+ }
+
+ // default to plain-text. send()
+ res.type('txt').send('Not found');
+
+});
+
+
module.exports = app;