aboutsummaryrefslogtreecommitdiff
path: root/app.js
diff options
context:
space:
mode:
authorHumairAK <humair88@hotmail.com>2016-07-26 07:43:04 +0000
committerHumairAK <humair88@hotmail.com>2016-07-26 07:43:04 +0000
commitf016bdbc35b7efa44bd63413bde09433ea916c59 (patch)
tree238a4ffbd447907876b2f1624cdb6f4abc3009eb /app.js
parent10f1c442e27d82d1fc2c94d1bc0a2ad27917b287 (diff)
added some unit testing, need a lot more
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 0b7eb57..4dc5199 100644
--- a/app.js
+++ b/app.js
@@ -67,4 +67,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;