function notFoundHandler(req, res) {
  return res.status(404).json({ message: 'Route not found' });
}

function errorHandler(err, req, res, next) {
  // eslint-disable-next-line no-unused-vars
  const _ = next;

  const statusCode = err.statusCode || 500;
  const message = err.message || 'Internal Server Error';

  // eslint-disable-next-line no-console
  console.error(err);

  return res.status(statusCode).json({ message });
}

module.exports = {
  notFoundHandler,
  errorHandler
};

