☚ GZOOL Quality Without A Name

Web Development with Node and Express Chapter 3 - Saving Time with Express

// 404 catch-all handler (middleware)
app.use(function(req, res, next){
  res.status(404);
  res.render('404');
});

// 500 error handler (middleware)
app.use(function(err, req, res, next){
  console.error(err.stack);
  res.status(500);
  res.render('500');
});
app.use(express.static(__dirname + '/public'));
comments powered by Disqus