README_tpl.hbs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # koa-router
  2. [![NPM version](https://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](https://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/)
  3. > Router middleware for [koa](https://github.com/koajs/koa)
  4. * Express-style routing using `app.get`, `app.put`, `app.post`, etc.
  5. * Named URL parameters.
  6. * Named routes with URL generation.
  7. * Responds to `OPTIONS` requests with allowed methods.
  8. * Support for `405 Method Not Allowed` and `501 Not Implemented`.
  9. * Multiple route middleware.
  10. * Multiple routers.
  11. * Nestable routers.
  12. * ES7 async/await support.
  13. {{#module name="koa-router"}}{{>body}}{{/module}}## Migrating to 7 / Koa 2
  14. - The API has changed to match the new promise-based middleware
  15. signature of koa 2. See the
  16. [koa 2.x readme](https://github.com/koajs/koa/tree/2.0.0-alpha.3) for more
  17. information.
  18. - Middleware is now always run in the order declared by `.use()` (or `.get()`,
  19. etc.), which matches Express 4 API.
  20. ## Installation
  21. Install using [npm](https://www.npmjs.org/):
  22. ```sh
  23. npm install koa-router
  24. ```
  25. ## API Reference
  26. {{#module name="koa-router"~}}
  27. {{>body~}}
  28. {{>member-index~}}
  29. {{>members~}}
  30. {{/module~}}
  31. ## Contributing
  32. Please submit all issues and pull requests to the [alexmingoia/koa-router](http://github.com/alexmingoia/koa-router) repository!
  33. ## Tests
  34. Run tests using `npm test`.
  35. ## Support
  36. If you have any problem or suggestion please open an issue [here](https://github.com/alexmingoia/koa-router/issues).