Node.js · Middle · Question 28 of 75

How do you define error-handling middleware in Express?

Explanation

Express recognizes error handlers by their four parameters. Register them after all routes. Calling next(err) skips regular middleware and jumps to them.

Further reading

Problem with a question

Node.js · Middle · question 28

Test yourself

Take the Node.js · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz