How to get Props in Middleware



For example, I have route with middleware with passed props:

  .post('posts', '')

How can I get this props inside ‘process’ middleware?


When writing middleware, you can pass 3 things to handle:

async handle(ctx, next, schemes) {

You are interested in third one.

In your case, schemes param will be equal to array: ['type']. You can pass multiple params to middleware schemes by using comma like: .middleware(['process:type,something']) will give you schemes array inside middleware that equals: ['type', 'something']


oh, thanks!) I’ll make PR for docs)