express 404
// Dopo tutte le altre route
app.get('*', function(req, res, next) {
var err = new Error();
err.status = 404;
next(err);
});
app.use(function(err, req, res, next) {
if (err.status === 404) {
var data = {
title: '404 Not Found',
content: 'Oops, page not found!';
};
res.render('pages/404', data);
} else {
return next();
}
});