-
#### 正常情况下,对不同的URL调用不同的处理函数,这样才能返回不同的结果。例如像这样写:
```js
app.use(async (ctx, next) => {
if (ctx.request.path === '/') {
ctx.response.body = 'index page';
} else {
await next…
-
node.js version: v12.2.0
npm/yarn and version: v6.9.0
`koa-router` version: ^7.4.0
`koa` version: ^2.7.0
#### Code sample:
```ts
import * as compose from 'koa-compose'
import { M…
polRk updated
5 years ago
-
I'm trying to migrate a code that is working with `@koa/router`, but the last middlware doesn't get called when using `koa-tree-router`:
```
router.use(...)
-
"koa": "^2.12.0",
"koa-compress": "^4.0.1",
"koa-router": "^8.0.8",
"koa-static": "^5.0.0",
-
I am working on a Koa v1 app and would like to implement new routes with async/await instead of generator functions. I found this library has `convert.back()` which is mostly working for me. However, …
-
I have this test:
```
import Koa from 'koa';
import Router from 'koa-router';
import http from 'http';
import request from 'supertest-as-promised';
import adminRoutes from '../../../routes/Adm…
-
I have written this piece of code
```js
const Koa = require("koa");
const Router = require('koa-router');
const app = new Koa();
const parentRouter = new Router()
const router = new Router({ p…
-
`@koa/router` version:
10.1.1
`koa` version:
2.13.4
#### Code sample:
In express route if we want to match multiple verbs with the same route we could provide the following syntax
```
exp…
-
## Version **7.2.0** of [koa-router](https://github.com/alexmingoia/koa-router) just got published.
Branch
Build failing 🚨
Dependency
…
-
With small video (mp4) files, chrome has no issues. However if I use a 34 mbish sort of a video file. It will sometimes play the first 2 secs, like (5%) of the file or just stay stuck in limbo and not…