koa-router
Advanced tools
Comparing version 5.3.0 to 5.4.0
# History | ||
## 7.0.0 | ||
## 5.4.0 | ||
- The API has changed to match the new promise-based middleware | ||
signature of koa 2. See the | ||
[koa 2.x readme](https://github.com/koajs/koa/tree/2.0.0-alpha.3) for more | ||
information. | ||
- Middleware is now always run in the order declared by `.use()` (or `.get()`, | ||
etc.), which matches Express 4 API. | ||
- Expose matched route at `ctx._matchedRoute`. | ||
@@ -12,0 +7,0 @@ ## 5.3.0 |
@@ -86,3 +86,4 @@ /** | ||
* | ||
* Route paths will be translated to regular expressions used to match requests. | ||
* Route paths will be translated to regular expressions using | ||
* [path-to-regexp](https://github.com/pillarjs/path-to-regexp). | ||
* | ||
@@ -314,2 +315,6 @@ * Query strings will not be considered when matching requests. | ||
i = matched.pathAndMethod.length; | ||
var mostSpecificPath = matched.pathAndMethod[matched.pathAndMethod.length - 1].path | ||
this._matchedRoute = mostSpecificPath | ||
while (matched.route && i--) { | ||
@@ -492,3 +497,3 @@ layer = matched.pathAndMethod[i]; | ||
* | ||
* @param {String} path Path string or regular expression. | ||
* @param {String} path Path string. | ||
* @param {Array.<String>} methods Array of HTTP verbs. | ||
@@ -579,4 +584,3 @@ * @param {Function} middleware Multiple middleware also accepted. | ||
/** | ||
* Generate URL for route. Takes either map of named `params` or series of | ||
* arguments (for regular expression routes). | ||
* Generate URL for route. Takes a route name and map of named `params`. | ||
* | ||
@@ -583,0 +587,0 @@ * ```javascript |
@@ -13,3 +13,3 @@ { | ||
"author": "Alex Mingoia <talk@alexmingoia.com>", | ||
"version": "5.3.0", | ||
"version": "5.4.0", | ||
"keywords": [ | ||
@@ -16,0 +16,0 @@ "koa", |
@@ -15,3 +15,3 @@ # koa-router | ||
* Nestable routers. | ||
* ES7 async/await support. | ||
* ES7 async/await support (koa-router 7.x). | ||
@@ -21,3 +21,3 @@ ## koa 2.x | ||
See [koa-router 7.x](https://github.com/alexmingoia/koa-router/tree/master/) | ||
for koa 2.x support. | ||
for koa 2.x and async/await support. | ||
@@ -99,3 +99,4 @@ ## Installation | ||
Route paths will be translated to regular expressions used to match requests. | ||
Route paths will be translated to regular expressions using | ||
[path-to-regexp](https://github.com/pillarjs/path-to-regexp). | ||
@@ -239,3 +240,3 @@ Query strings will not be considered when matching requests. | ||
| [options.throw] | <code>Boolean</code> | throw error instead of setting status and header | | ||
| [options.notImplemented] | <code>Function</code> | throw throw the returned value in place of the default NotImplemented error | | ||
| [options.notImplemented] | <code>Function</code> | throw the returned value in place of the default NotImplemented error | | ||
| [options.methodNotAllowed] | <code>Function</code> | throw the returned value in place of the default MethodNotAllowed error | | ||
@@ -304,4 +305,3 @@ | ||
#### router.url(name, params) ⇒ <code>String</code> | <code>Error</code> | ||
Generate URL for route. Takes either map of named `params` or series of | ||
arguments (for regular expression routes). | ||
Generate URL for route. Takes the route name and a map of named `params`. | ||
@@ -308,0 +308,0 @@ ```javascript |
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
817
40977