Skip to content

Instantly share code, notes, and snippets.

@AshleyCoder3
Created September 7, 2021 20:16
Show Gist options
  • Select an option

  • Save AshleyCoder3/30c0bba279232ff50e2c9947a2aa3ba7 to your computer and use it in GitHub Desktop.

Select an option

Save AshleyCoder3/30c0bba279232ff50e2c9947a2aa3ba7 to your computer and use it in GitHub Desktop.
500ErrorMiddleware
//***********************500 error middleware***********//
//eslint-disable-next-line
server.use((err, req, res, next) => {
res.status(err.status || 500).json({
message: err.message,
devMessage: 'Something bad inside the server!'
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment