Redirecting to '/' is not a 404 (#1 addendum)

master
Keith Irwin 2016-05-02 05:31:34 +00:00
parent d9376a6122
commit 77985fbc47
1 changed files with 6 additions and 4 deletions

View File

@ -59,7 +59,7 @@
}); });
// Routes // Routes
app.use( app.use('/',
require('./config/routes/index.js'), require('./config/routes/index.js'),
require('./config/routes/auth.js'), require('./config/routes/auth.js'),
require('./config/routes/feedback.js'), require('./config/routes/feedback.js'),
@ -71,9 +71,11 @@
app.use('/admin', require('./config/routes/admin.js')); app.use('/admin', require('./config/routes/admin.js'));
app.use('/static', express.static(__dirname+'/static')); app.use('/static', express.static(__dirname+'/static'));
app.use(function(req,res,next) { app.use(function(req,res,next) {
var err = new Error('Not Found'); if (!res.headersSent) {
err.status = 404; var err = new Error('404: Not found: '+req.url);
next(err); err.status = 404;
next(err);
}
}); });
// Error Handlers // Error Handlers