Nuxt Global Middleware #25061
Replies: 2 comments 2 replies
-
use
|
Beta Was this translation helpful? Give feedback.
-
In Nuxt.js, when you use Here is an example of how you can exclude a specific route from the global middleware: // nuxt.config.js
export default {
// Other config options...
router: {
middleware: ['auth'],
},
globalMiddleware: [
async (to, from, next) => {
// Global middleware logic
console.log('Global middleware');
next();
},
],
auth: {
except: ['/exclude-this-route'],
},
}; In this example:
By using the |
Beta Was this translation helpful? Give feedback.
-
I've create nuxt modules for internal project, inside that i created global middleware, named
auth
. It is added viaaddRouteMiddleware
function throughplugin.ts
as globalIn other nuxt app that uses this nuxt modules is also injected this auth automaticaly (as expected), but i want to disable this
auth middleware
on specific page. Is there any chance i can do this? Thanks 🐎Beta Was this translation helpful? Give feedback.
All reactions