Skip to content

Koa middleware to add all enumerable keys to the context of each request

License

Notifications You must be signed in to change notification settings

cesarandreu/koa-add-to-context

Repository files navigation

koa-add-to-context

npm version build status coverage status

Koa middleware to add all enumerable keys to the context of each request

Installation

$ npm i koa-add-to-context

Usage

var addToContext = require('koa-add-to-context')
var koa = require('koa')

var app = koa()
app.use(addToContext({ foo: 'foo' }))
app.use(function * () {
  this.body = this.foo
})

API

addToContext(obj: Object): GeneratorFunction

Test

npm test

License

MIT

About

Koa middleware to add all enumerable keys to the context of each request

Resources

License

Stars

Watchers

Forks

Packages

No packages published