router
router copied to clipboard
Router middleware for Koa. Maintained by @forwardemail and @ladjs.
Please make v12.0.1 the latest release in npm, as v11.0.2 is incorrectly tagged as latest. Here is the result of running `npm outdated` in a project with a `@koa/router` v12.0.1...
Koa version: 2.13.4 @koa/router version: 11.0.1 ``` const Koa = require('koa'); const Router = require('@koa/router'); const app = new Koa(); const router = new Router(); router.get('/', async(ctx, next) => {...
Hello! I'm trying to implement a pretty trivial thing — a catch-all handler that will return 404 when request handler is not found for the request in question, however, I...
## Describe the bug **Node.js version:** v20.12.0 **OS version:** Ubuntu 22.04 **Description:** @koa/router does not handle decoding URL with '+' character properly. With reference to [https://en.wikipedia.org/wiki/Percent-encoding](url): > When data that...
`allowedMethods()` throws a runtime error when the `host` of its router fails to match. Additionally it would throw if you never added `routes()` to your koa middleware chain. Example: ```...
为何只有 body 不能设置类型,难道只能使用 `request.body as {...}` 方式吗,希望解决下面的使用出现的类型丢失问题  源代码如下("@types/koa": "2.13.10", "@types/koa__router": "12.0.3") ``` typescript import Router from "@koa/router" const router = new Router() interface KoaState { a: string } interface...
#### Descriptions The middleware used in a nested-router can be triggered if the regexp matches (matchedRoute) with the unrelated path. The behavior is something intuitive or not easily predictable. I...
## Describe the bug **Node.js version:** 18.17.1 **@koa/router:** 12.0.0 **Typescript target:** ES2020 **OS version:** Windows 10 Enterprise **Description:** router.use method doesn't work with RegExp ## Actual behavior I'm trying to...
## Checklist - [x] I have ensured my pull request is not behind the main or master branch of the original repository. - [x] I have rebased all commits where...
## Describe the feature I'm trying to add new overload for the router[method] function, to add a validation middleware easily by passing a jsonSchema as the function second parameter. Right...