Async Context Middleware
Request-scoped async context middleware that stores each request context inAsyncLocalStorage so utilities can access it anywhere in the same async call stack.
Installation
Functions
asyncContext()
Creates middleware that stores the request context in AsyncLocalStorage.
Signature:
AsyncLocalStorage.
Example:
getContext()
Retrieves the request context from AsyncLocalStorage.
Signature:
Usage with Router
Requirements
This middleware requires support fornode:async_hooks.
Related
- fetch-router - Router for the web Fetch API