ot-context

0.0.3 • Public • Published

ot-context-nodejs

The 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.

Context Object

The context object is a simple dictionary.

The current context may always be retrieved with the context.current() method. You may create a new context with the context.enter(next) method. You may ensure a context exists with the context.ensure(next) method.

context.middleware is Express middleware that enters a new context for every request, implementing a basic request scope.

Installation

npm install --save ot-context

Readme

Keywords

none

Package Sidebar

Install

npm i ot-context

Weekly Downloads

2

Version

0.0.3

License

MIT

Last publish

Collaborators

  • acolchado
  • arnoldzokas
  • matteofigus
  • ryantomlinson
  • andyroyle