# koa-router
|
|
[](https://npmjs.org/package/koa-router) [](https://npmjs.org/package/koa-router) [](http://nodejs.org/download/) [](http://travis-ci.org/alexmingoia/koa-router) [](https://www.gratipay.com/alexmingoia/) [](https://gitter.im/alexmingoia/koa-router/)
|
|
> Router middleware for [koa](https://github.com/koajs/koa)
|
|
* Express-style routing using `app.get`, `app.put`, `app.post`, etc.
|
* Named URL parameters.
|
* Named routes with URL generation.
|
* Responds to `OPTIONS` requests with allowed methods.
|
* Support for `405 Method Not Allowed` and `501 Not Implemented`.
|
* Multiple route middleware.
|
* Multiple routers.
|
* Nestable routers.
|
* ES7 async/await support.
|
|
{{#module name="koa-router"}}{{>body}}{{/module}}## Migrating to 7 / Koa 2
|
|
- 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.
|
|
## Installation
|
|
Install using [npm](https://www.npmjs.org/):
|
|
```sh
|
npm install koa-router
|
```
|
|
## API Reference
|
{{#module name="koa-router"~}}
|
{{>body~}}
|
{{>member-index~}}
|
{{>members~}}
|
{{/module~}}
|
|
## Contributing
|
|
Please submit all issues and pull requests to the [alexmingoia/koa-router](http://github.com/alexmingoia/koa-router) repository!
|
|
## Tests
|
|
Run tests using `npm test`.
|
|
## Support
|
|
If you have any problem or suggestion please open an issue [here](https://github.com/alexmingoia/koa-router/issues).
|