CodeZettaInterview Hub

Node.js · Express Concepts · Fresh / Intern · Concept

What is Express middleware and how does the chain work?

Short Interview Answer

Functions (req, res, next) that run in order; next() continues, next(err) jumps to error handlers.

Detailed Explanation

Order matters: parsers before routes, auth before protected routes, error handlers last. Forgetting next() hangs requests.

Common Mistake

Async middleware without catching rejections / calling next(err).

Did you know this answer?