Closed Aurelsicoko closed 8 years ago
Okay, I found the solution. This is pretty simple.
var router = require('koa-joi-router');
var users = router();
router.route({
method: 'GET',
path: '/user/:id',
handler: [runThisBeforeHandlerForGET, handler]
});
router.route({
method: 'POST',
path: '/user',
handler: [runThisBeforeHandlerForPOST, handler]
});
Hi! Thanks for your amazing work on this router!
I was wondering, if the router is able to execute a middleware before hitting a specifc path + method. In the documentation, I saw that is possible for a specific path but without method allocated to it.
Is it possible?