diff --git a/README.md b/README.md index 46765b7..f73010c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # inversify-koa-utils -[![Join the chat at https://gitter.im/inversify/InversifyJS](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/inversify/InversifyJS?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![inversify chat https://gitter.im/inversify/InversifyJS](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/inversify/InversifyJS?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://secure.travis-ci.org/diego-d5000/inversify-koa-utils.svg?branch=master)](https://travis-ci.org/diego-d5000/inversify-koa-utils) [![Test Coverage](https://codeclimate.com/github/diego-d5000/inversify-koa-utils/badges/coverage.svg)](https://codeclimate.com/github/diego-d5000/inversify-koa-utils/coverage) [![npm version](https://badge.fury.io/js/inversify-koa-utils.svg)](http://badge.fury.io/js/inversify-koa-utils) @@ -234,9 +234,15 @@ Binds a method parameter to request.body or to a specific body property if a nam ### `@requestHeaders(name?: string)` Binds a method parameter to the request headers. +### `@context()` +Binds a method parameter to the koa context object. + ### `@cookies()` Binds a method parameter to the request cookies. +### `@context()` +Binds a method parameter to the koa context object. + ### `@next()` Binds a method parameter to the next() function. diff --git a/package.json b/package.json index b9df731..0a5a912 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "inversify-koa-utils", - "version": "1.0.0", + "version": "1.0.1", "description": "Some utilities for the development of koa applications with Inversify", "main": "lib/index.js", "jsnext:main": "es/index.js", diff --git a/src/constants.ts b/src/constants.ts index efb1203..7c66f5f 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,5 +1,5 @@ const TYPE = { - Controller: Symbol("Controller") + Controller: Symbol.for("Controller") }; const METADATA_KEY = { diff --git a/src/index.ts b/src/index.ts index 07b7e53..009a05e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ import { InversifyKoaServer } from "./server"; import { controller, httpMethod, httpGet, httpPut, httpPost, httpPatch, httpHead, all, httpDelete, request, response, requestParam, queryParam, - requestBody, requestHeaders, cookies, next } from "./decorators"; + requestBody, requestHeaders, cookies, next, context } from "./decorators"; import { TYPE } from "./constants"; import { interfaces } from "./interfaces"; @@ -25,5 +25,6 @@ export { requestBody, requestHeaders, cookies, - next + next, + context };