koa-router
Advanced tools
Comparing version 7.0.0 to 7.0.1
# History | ||
## 7.0.1 | ||
- Fix: allowedMethods should be ctx.method not this.method [#215](https://github.com/alexmingoia/koa-router/pull/215) | ||
## 7.0.0 | ||
@@ -11,10 +15,7 @@ | ||
etc.), which matches Express 4 API. | ||
- Register multiple routes with array of paths [#203]. | ||
## 6.2.0 | ||
## 5.3.0 | ||
- Register multiple routes with array of paths [#203](https://github.com/alexmingoia/koa-router/issue/143). | ||
- Improved router.url() [#143](https://github.com/alexmingoia/koa-router/pull/143) | ||
## 6.1.0 | ||
- Adds support for named routes and regular expressions | ||
@@ -24,10 +25,2 @@ [#152](https://github.com/alexmingoia/koa-router/pulls/152) | ||
## 6.0.1 | ||
- Fixes `.param()` async issue [#208](https://github.com/alexmingoia/koa-router/issues/208) | ||
## 6.0.0 | ||
- Koa 2.x support. See [#202](https://github.com/alexmingoia/koa-router/pull/202) | ||
## 5.2.3 | ||
@@ -34,0 +27,0 @@ |
@@ -144,3 +144,3 @@ var debug = require('debug')('koa-router'); | ||
* router | ||
* .param('user', function *(id, ctx, next) { | ||
* .param('user', function (id, ctx, next) { | ||
* ctx.user = users[id]; | ||
@@ -147,0 +147,0 @@ * if (!user) return ctx.status = 404; |
@@ -65,3 +65,3 @@ /** | ||
/** | ||
* Create `router.verb()` methods, where *verb* is one of the HTTP verbes such | ||
* Create `router.verb()` methods, where *verb* is one of the HTTP verbs such | ||
* as `router.get()` or `router.post()`. | ||
@@ -134,4 +134,4 @@ * | ||
* | ||
* posts.get('/', function *(ctx, next) {...}); | ||
* posts.get('/:pid', function *(ctx, next) {...}); | ||
* posts.get('/', function (ctx, next) {...}); | ||
* posts.get('/:pid', function (ctx, next) {...}); | ||
* forums.use('/forums/:fid/posts', posts.routes(), posts.allowedMethods()); | ||
@@ -392,3 +392,3 @@ * | ||
ctx.set('Allow', allowedArr); | ||
} else if (!allowed[this.method]) { | ||
} else if (!allowed[ctx.method]) { | ||
if (options.throw) { | ||
@@ -395,0 +395,0 @@ var notAllowedThrowable; |
@@ -13,3 +13,3 @@ { | ||
"author": "Alex Mingoia <talk@alexmingoia.com>", | ||
"version": "7.0.0", | ||
"version": "7.0.1", | ||
"keywords": [ | ||
@@ -16,0 +16,0 @@ "koa", |
# koa-router | ||
[![NPM version](http://img.shields.io/npm/v/koa-router.svg?style=flat)](https://npmjs.org/package/koa-router) [![NPM Downloads](https://img.shields.io/npm/dm/koa-router.svg?style=flat)](https://npmjs.org/package/koa-router) [![Node.js Version](https://img.shields.io/node/v/koa-router.svg?style=flat)](http://nodejs.org/download/) [![Build Status](http://img.shields.io/travis/alexmingoia/koa-router.svg?style=flat)](http://travis-ci.org/alexmingoia/koa-router) [![Tips](https://img.shields.io/gratipay/alexmingoia.svg?style=flat)](https://www.gratipay.com/alexmingoia/) [![Gitter Chat](https://img.shields.io/badge/gitter-join%20chat-1dce73.svg?style=flat)](https://gitter.im/alexmingoia/koa-router/) | ||
[![NPM version](https://img.shields.io/badge/npm-v7.0.1-blue.svg?style=flat)](https://npmjs.org/package/koa-router) [![NPM Downloads](https://img.shields.io/npm/dm/koa-router.svg?style=flat)](https://npmjs.org/package/koa-router) [![Node.js Version](https://img.shields.io/node/v/koa-router.svg?style=flat)](http://nodejs.org/download/) [![Build Status](http://img.shields.io/travis/alexmingoia/koa-router.svg?style=flat)](http://travis-ci.org/alexmingoia/koa-router) [![Tips](https://img.shields.io/gratipay/alexmingoia.svg?style=flat)](https://www.gratipay.com/alexmingoia/) [![Gitter Chat](https://img.shields.io/badge/gitter-join%20chat-1dce73.svg?style=flat)](https://gitter.im/alexmingoia/koa-router/) | ||
@@ -28,8 +28,11 @@ > Router middleware for [koa](https://github.com/koajs/koa) | ||
Install using [npm](https://www.npmjs.org/): | ||
Until koa 2 is released, you must specify `^7.0.0` or use the `next` tag: | ||
```sh | ||
npm install koa-router | ||
npm install koa-router@next | ||
``` | ||
When koa 2 is released, 7.x will be tagged with `latest` and installed by | ||
default by NPM. | ||
## API Reference | ||
@@ -81,3 +84,3 @@ | ||
#### router.get|put|post|patch|delete ⇒ <code>Router</code> | ||
Create `router.verb()` methods, where *verb* is one of the HTTP verbes such | ||
Create `router.verb()` methods, where *verb* is one of the HTTP verbs such | ||
as `router.get()` or `router.post()`. | ||
@@ -150,4 +153,4 @@ | ||
posts.get('/', function *(ctx, next) {...}); | ||
posts.get('/:pid', function *(ctx, next) {...}); | ||
posts.get('/', function (ctx, next) {...}); | ||
posts.get('/:pid', function (ctx, next) {...}); | ||
forums.use('/forums/:fid/posts', posts.routes(), posts.allowedMethods()); | ||
@@ -154,0 +157,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41614
400