koay-router

1.1.1 • Public • Published

koay-router

NPM package

Note: Provide a faster router for Koa, and support configurable routes for Koa or express.


NPM version NPM Downloads

Router middleware for koa

  • Express-style routing using app.get, app.put, app.post, etc.
  • Named URL parameters.
  • Named routes with URL generation.
  • Multiple route middleware.
  • Multiple routers.
  • Nestable routers.
  • ES7 async/await support.

Installation

Install using npm:

npm install koay-router --save

API Reference

  • koay-router
    • Router

      • new Router([opts])
        • instance

          • .get|put|post|patch|delete|del ⇒ Router
          • .routes ⇒ function
          • .use([path], middleware)] ⇒ Router
          • .prefixWith(prefix) ⇒ Router
          • .redirect(source, destination, [code]) ⇒ Router
          • .route(name) ⇒ Route | null
          • .url(name, params, [options]) ⇒ String
        • static

          • .url(path, params, [options]) ⇒ String
    • Controller

      • new Controller([opts])
        • instance
          • routes ⇒ function

Examples

Package Sidebar

Install

npm i koay-router

Weekly Downloads

1

Version

1.1.1

License

MIT

Unpacked Size

18 kB

Total Files

11

Last publish

Collaborators

  • fengxinming