Concept Flow - Request context middleware
Incoming HTTP Request
Middleware 1: Setup Context
Attach Context to req
Next Middleware or Route Handler
Use Context in Handlers
Send Response
Request Ends
The middleware intercepts each request, creates a context object, attaches it to the request, then passes control to the next handler which can use this context.