🌿 Nuxt.js
Beginner
What is Nuxt.js middleware?
Answer
Middleware in Nuxt.js are functions that run before navigating to a particular route. They can be used for authentication checks, redirects, analytics, or any pre-navigation logic. There are three types: inline middleware (defined directly in definePageMeta), named middleware (files in the middleware/ directory referenced by name), and global middleware (files in middleware/ with a .global.ts suffix that run on every route). Server middleware, stored in server/middleware/, runs on the Nitro server side and intercepts all API requests. Middleware receives the to and from route objects.
Previous
What is the `public/` directory in Nuxt.js?
Next
What is the `server/` directory in Nuxt.js?