We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
node.js version: v12.2.0
npm/yarn and version: v6.9.0
koa-router version: ^7.4.0
koa-router
koa version: ^2.7.0
koa
import * as compose from 'koa-compose' import { Middleware } from 'koa' import * as Router from 'koa-router' const server = new Koa<AppState, AppContext>() const router = new Router<AppState, AppContext>() middleware: Map<string, Middleware<AppState, AppContext>> = new Map() middleware.set('first', async (ctx, next) => { await 10s ... await next() }) middleware.set('second', async (ctx, next) => { await 20s ... await next() }) router.use('/path', compose([...middleware.values()])) server.use(router.routes()) server.use(async context => { context.body = 'OK' })
All handlers(middleware) should work
No handler works
<-- POST /path --> POST /path 200 6ms 2b
The text was updated successfully, but these errors were encountered:
console.log([...middleware.values()]) // [ [AsyncFunction], [AsyncFunction] ]
Sorry, something went wrong.
But
server.middleware.push(...middleware.values()) // It's working
And this works
server.use(compose([...middleware.values()]))
No branches or pull requests
node.js version: v12.2.0
npm/yarn and version: v6.9.0
koa-router
version: ^7.4.0koa
version: ^2.7.0Code sample:
Expected Behavior:
All handlers(middleware) should work
Actual Behavior:
No handler works
Log:
The text was updated successfully, but these errors were encountered: