koa-router

Router middleware for koa. Maintained by Forward Email and Lad.

MIT 93 个版本
安装
npm install koa-router
yarn add koa-router
pnpm add koa-router
bun add koa-router
README

@koa/router

Router middleware for Koa. Maintained by Forward Email and Lad.

build status

styled with prettier made with lass license

Table of Contents

Features

  • Express-style routing (app.get, app.put, app.post, etc.)
  • Named URL parameters
  • Named routes with URL generation
  • Match routes with specific host
  • Responds to OPTIONS requests with allowed methods
  • Support for 405 Method Not Allowed and 501 Not Implemented
  • Multiple route middleware
  • Multiple and nestable routers
  • async/await support

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 for more information.
  • Middleware is now always run in the order declared by .use() (or .get(), etc.), which matches Express 4 API.

Install

npm:

npm install @koa/router

Typescript Support

npm install --save-dev @types/koa__router

API Reference

See API Reference for more documentation.

Contributors

Name
Alex Mingoia
@koajs
Imed Jaberi

License

MIT © Alex Mingoia

版本列表
14.0.0 2025-08-02
13.1.1 2025-07-01
13.0.1 2024-09-13
12.0.1 2023-10-12
12.0.0 2022-07-19
11.0.2 2023-10-12
11.0.1 2022-07-04
11.0.0 2022-07-04
10.1.1 2021-08-22
10.0.0 2020-11-02
9.4.0 2020-08-14
9.1.0 2020-06-30
9.0.1 2020-05-30
8.0.8 2020-02-15
8.0.7 2020-02-06
8.0.6 2020-01-22
8.0.0-alpha.1 2018-04-28
7.4.0 2018-01-30
7.3.0 2017-11-13
7.2.1 2017-06-17
7.2.0 2017-05-23
7.1.1 2017-03-30
7.1.0 2016-12-31
7.0.1 2016-01-20
7.0.0 2015-11-25
6.2.0 2015-11-24
6.1.0 2015-11-24
6.0.1 2015-11-24
6.0.0 2015-11-22
5.4.2 2017-05-23
5.4.1 2017-03-30
5.4.0 2016-02-11
5.3.0 2015-11-26
5.2.3 2015-10-03
5.2.2 2015-10-02
5.2.1 2015-09-27
5.2.0 2015-09-27
5.1.2 2015-06-08
5.1.1 2015-06-02
5.1.0 2015-06-01
5.0.1 2015-05-21
5.0.0 2015-05-21
4.3.2 2015-04-03
4.3.1 2015-04-03
4.3.0 2015-03-30
4.2.0 2015-02-20
4.1.0 2015-02-11
4.0.1 2015-02-10
4.0.0 2015-02-10
3.8.0 2014-12-22
3.7.0 2014-11-14
3.6.0 2014-11-09
3.5.0 2014-10-24
3.4.0 2014-09-14
3.3.1 2014-09-03
3.3.0 2014-08-24
3.2.3 2014-07-26
3.2.2 2014-07-22
3.2.1 2014-07-06
3.2.0 2014-07-06
3.1.4 2014-05-12
3.1.3 2014-04-29
3.1.2 2014-03-14
3.1.1 2014-03-11
3.1.0 2014-03-01
3.0.2 2014-02-14
3.0.1 2014-02-09
3.0.0 2014-02-03
2.4.4 2014-01-30
2.4.3 2014-01-30
2.4.1 2014-01-26
2.4.0 2014-01-23
2.3.3 2014-01-27
2.3.2 2014-01-26
2.3.1 2014-01-19
2.3.0 2014-01-15
2.2.0 2013-12-28
2.1.0 2013-12-27
2.0.1 2013-12-23
2.0.0 2013-12-20
1.6.1 2013-12-19
1.6.0 2013-12-18
1.5.5 2013-09-10
1.5.4 2013-09-06
1.5.3 2013-09-04
1.4.3 2013-09-03
1.3.3 2013-09-02
1.2.3 2013-08-31
1.2.2 2013-08-31
1.1.2 2013-08-31
1.1.1 2013-08-31
1.0.1 2013-08-30
1.0.0 2013-08-30