UNPKG

4 kBMarkdownView Raw
1# History
2
3## 7.0.0
4
5- The API has changed to match the new promise-based middleware
6 signature of koa 2. See the
7 [koa 2.x readme](https://github.com/koajs/koa/tree/2.0.0-alpha.3) for more
8 information.
9- Middleware is now always run in the order declared by `.use()` (or `.get()`,
10 etc.), which matches Express 4 API.
11- Register multiple routes with array of paths [#203].
12
13## 6.2.0
14
15- Improved router.url() [#143](https://github.com/alexmingoia/koa-router/pull/143)
16
17## 6.1.0
18
19- Adds support for named routes and regular expressions
20 [#152](https://github.com/alexmingoia/koa-router/pulls/152)
21- Add support for custom throw functions for 405 and 501 responses [#206](https://github.com/alexmingoia/koa-router/pull/206)
22
23## 6.0.1
24
25- Fixes `.param()` async issue [#208](https://github.com/alexmingoia/koa-router/issues/208)
26
27## 6.0.0
28
29- Koa 2.x support. See [#202](https://github.com/alexmingoia/koa-router/pull/202)
30
31## 5.2.3
32
33- Fix for middleware running twice when nesting routes [#184](https://github.com/alexmingoia/koa-router/issues/184)
34
35## 5.2.2
36
37- Register routes without params before those with params [#183](https://github.com/alexmingoia/koa-router/pull/183)
38- Fix for allowed methods [#182](https://github.com/alexmingoia/koa-router/issues/182)
39
40## 5.2.0
41
42- Add support for async/await. Resolves [#130](https://github.com/alexmingoia/koa-router/issues/130).
43- Add support for array of paths by Router#use(). Resolves [#175](https://github.com/alexmingoia/koa-router/issues/175).
44- Inherit param middleware when nesting routers. Fixes [#170](https://github.com/alexmingoia/koa-router/issues/170).
45- Default router middleware without path to root. Fixes [#161](https://github.com/alexmingoia/koa-router/issues/161), [#155](https://github.com/alexmingoia/koa-router/issues/155), [#156](https://github.com/alexmingoia/koa-router/issues/156).
46- Run nested router middleware after parent's. Fixes [#156](https://github.com/alexmingoia/koa-router/issues/156).
47- Remove dependency on koa-compose.
48
49## 5.1.1
50
51- Match routes in order they were defined. Fixes #131.
52
53## 5.1.0
54
55- Support mounting router middleware at a given path.
56
57## 5.0.1
58
59- Fix bug with missing parameters when nesting routers.
60
61## 5.0.0
62
63- Remove confusing API for extending koa app with router methods. Router#use()
64 does not have the same behavior as app#use().
65- Add support for nesting routes.
66- Remove support for regular expression routes to achieve nestable routers and
67 enable future trie-based routing optimizations.
68
69## 4.3.2
70
71- Do not send 405 if route matched but status is 404. Fixes #112, closes #114.
72
73## 4.3.1
74
75- Do not run middleware if not yielded to by previous middleware. Fixes #115.
76
77## 4.3.0
78
79- Add support for router prefixes.
80- Add MIT license.
81
82## 4.2.0
83
84- Fixed issue with router middleware being applied even if no route was
85matched.
86- Router.url - new static method to generate url from url pattern and data
87
88## 4.1.0
89
90Private API changed to separate context parameter decoration from route
91matching. `Router#match` and `Route#match` are now pure functions that return
92an array of routes that match the URL path.
93
94For modules using this private API that need to determine if a method and path
95match a route, `route.methods` must be checked against the routes returned from
96`router.match()`:
97
98```javascript
99var matchedRoute = router.match(path).filter(function (route) {
100 return ~route.methods.indexOf(method);
101}).shift();
102```
103
104## 4.0.0
105
106405, 501, and OPTIONS response handling was moved into separate middleware
107`router.allowedMethods()`. This resolves incorrect 501 or 405 responses when
108using multiple routers.
109
110### Breaking changes
111
1124.x is mostly backwards compatible with 3.x, except for the following:
113
114- Instantiating a router with `new` and `app` returns the router instance,
115 whereas 3.x returns the router middleware. When creating a router in 4.x, the
116 only time router middleware is returned is when creating using the
117 `Router(app)` signature (with `app` and without `new`).