From f016bdbc35b7efa44bd63413bde09433ea916c59 Mon Sep 17 00:00:00 2001 From: HumairAK Date: Tue, 26 Jul 2016 03:43:04 -0400 Subject: added some unit testing, need a lot more --- app.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'app.js') 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; -- cgit v1.2.3