ot-context package provides support for holding a context object
that is bound to e.g. a request scope. This is useful for holding
metadata such as a RequestId token or user authorization.
Ideally such context would be passed around explicitly. However, requiring all code and modules that run inside of a request context to be aware of this context mechanism is a monumental problem.
The context object is a simple dictionary.
The current context may always be retrieved with the
You may create a new context with the
You may ensure a context exists with the
context.middleware is Express middleware that enters a new context for every request,
implementing a basic request scope.
npm install --save ot-context