What is middleware in Express.js?
Instruction: Define middleware in the context of Express.js and its use cases.
Context: This question evaluates the candidate's understanding of middleware functions in Express.js, which are crucial for handling HTTP requests.
Updated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
Express middleware participates in request processing. Ordinary middleware receives req, res and next; it can attach request-local information, send a response, or pass control onward. If it neither completes a response nor arranges further processing, the request can remain pending.
This complete Express 5 example shows ordered middleware and a public response:...