404 errors?

Errors are already addressed in Express for you. In the app.js file, there is the following:

  1. /// catch 404 and forwarding to error handler
  2. app.use(function(req, res, next) {
  3. var err = new Error('Not Found');
  4. err.status = 404;
  5. next(err);
  6. });

Then in the views/ dir, there is errors.jade.

  1. extends layout
  2. block content
  3. h1= message
  4. h2= error.status
  5. pre #{error.stack}

Simple. If you want to customize your 404 page, simply edit this view.