I want to pass a parameter into middleware
router.get(
'/:id',
myMiddlware({projectid : ctx.request.query.projectid } ),
async (ctx) => {...}
)
I need to get the value of 'projectid' in the middleware declaration but of course, ctx from Koa-router isn't created yet (I think).
My middleware is defined as :
module.exports.myMiddleware = (fromSource) => async (ctx, next) => {...
I know I'm making a logical mistake somewhere!