Answer
Express processes matching middleware in registration order. Earlier middleware can modify the request, finish the response, or pass control onward.
Explanation
Register prerequisites before the routes that need them.
Example
JSON parser → authentication → protected route → error handler