Nuxt 3 Route Middleware

Опубликовано: 18 Октябрь 2024
на канале: Chris Dixon
5,345
78

Route middleware is code that we may want to run before navigating to a particular route, you can think of it as an extra stage to pass through before completion. It can be applied to all routes in our app, or on particular routes.

Use cases could include checking if a user is logged in before visiting a certain admin/account page, or, checking if a shopping basket contains items inside before visiting the checkout page.

Note, router middleware is not the same as server middleware which is also available in Nuxt.js.

Text/blog version of this video can be found here:
https://chrisdixon.dev/blog/2022-12-0...

======================
Learn more about Nuxt.js and web development:
https://chrisdixon.dev/courses
======================