Utility for handling errors
function handleError(err, req, res) {
    switch (err.name) {
      case 'NotFoundError':
        res.send(err, 404);
        break;
      default:
        res.send(err, 500);
    }
  }