How to assign a middleware to custom routes?
So for file-system based routing you assign middleware to individual pages or a parent page through definePageMeta utility function. But, as definePageMeta is ignored in custom routing, how do you assign a middleware in this case. I have gone through the documentation but couldn't find any clean solutions. I think you should be able to assign middleware to routes in
But this doesn't work. Do you have any better solution for this?
router.options.js file like this:But this doesn't work. Do you have any better solution for this?