koa2-router
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -19,2 +19,3 @@ /*! | ||
var mixin = require('utils-merge') | ||
var compose = require('koa-compose') | ||
var debug = require('debug')('koa2-router') | ||
@@ -598,2 +599,7 @@ var deprecate = require('depd')('koa2-router') | ||
if (callbacks.length > 1 && path !== '/' && path !== '*') { | ||
// compose callbacks as one middleware | ||
callbacks = [ compose(callbacks) ]; | ||
} | ||
for (var i = 0; i < callbacks.length; i++) { | ||
@@ -600,0 +606,0 @@ var fn = callbacks[i] |
{ | ||
"name": "koa2-router", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "A express-liked router component for koa2", | ||
@@ -23,2 +23,3 @@ "main": "index.js", | ||
"depd": "^2.0.0", | ||
"koa-compose": "^4.1.0", | ||
"methods": "^1.1.2", | ||
@@ -25,0 +26,0 @@ "parseurl": "^1.3.2", |
@@ -7,2 +7,9 @@ # koa2-router | ||
## Features | ||
* Express-style routing using .use|.params|.all|.route|[method] | ||
* Arrayed path prefix | ||
* Multiple, nestable router stacks | ||
* 405 Method Not Allowed support | ||
* 501 Not Implemented support | ||
* Named router for debug | ||
* Bounded baseUrl|url|params|matched|responded upon app.context|request|response | ||
@@ -169,2 +176,22 @@ ## Getting Started | ||
## API Documents | ||
### Context | ||
* ctx.baseUrl | ||
* ctx.url | ||
* ctx.params | ||
* ctx.matched | ||
* ctx.responded | ||
### Router | ||
* class Router(name: String | opts: Object):(ctx, next) => void | ||
* router.use([path: String | String[]], ...middlewares: (ctx, next) => void):Router | ||
* router.route(path: String | String[]):Route | ||
* router.all([path: String | String[]], ...middlewares: (ctx, next) => void):Router | ||
* router[method]([path: String | String[]], ...middlewares: (ctx, next) => void):Router | ||
* router.params(name: String, callback: (ctx, next, value, name) => void):Router | ||
### Route | ||
* route.all([path: String | String[]], ...middlewares: (ctx, next) => void):Router | ||
* route[method]([path: String | String[]], ...middlewares: (ctx, next) => void):Router | ||
## Acknowledgements | ||
@@ -171,0 +198,0 @@ * Thanks to the [expressjs/express][1] project |
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
36064
998
210
10
4
+ Addedkoa-compose@^4.1.0
+ Addedkoa-compose@4.2.0(transitive)