NuxtN
Nuxt9mo ago
22 replies
WiFi Plug

auth for specific routes

I have pages like /account/ and /admin/ i want to protect so i made a middleware
'/account/**': {
      meta: { requiredRole: 'user', middleware: ['auth'] },
    },
    '/admin/**': {
      meta: { requiredRole: 'admin', middleware: ['auth'] },
    },
I put this into my nuxt config routerules is this the right way to go about it compared to specifying the middleware per layout or per page?
Was this page helpful?