In Express.js, which middleware is used to handle errors?

  • bodyParser
  • errorHandler
  • static
  • router
In Express.js, the errorHandler middleware is used to handle errors. It's specifically designed to catch errors that occur during request processing and handle them gracefully. The other options are used for different purposes, such as parsing request bodies (bodyParser), serving static files (static), and defining routes (router).
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *