In this video, you will learn how to create middlewares in Nuxt 3. We will create 2 middlewares, Auth and Guest. Auth will check the cookie if there is a token in the authentication cookie then allow the user to move to the page. Guest middleware will check the cookie if there is a value then it will not allow user to move to login and signup page.
🧲 Timestamps:
00:00 – Introduction
00:18 – Create Middlwares
00:47 – Setup Auth Middleware
01:44 – Setup Guest Middleware
01:56 – Create Index page
02:31 – Apply Guest Middleware
03:13 – Testing Middlewares
03:28 – Redirect On Login & Signup
04:09 – Add Navbar On Index
04:16 – Redirect On Logout
04:22 – Testing Guest Middleware
04:56 – Cookie Warning
05:45 – Conclusion
🧲 Checkout our projects at GitHub:
🧲 VSCode:
● Font: Cascadia Code
● Theme: Obsidian Dark
🧲 Personal Tech Stack:
● Laravel, Livewire
● VueJs, NuxtJS
● MySQL, mongoDB, Pocketbase
● TailwindCSS
● LAMP Stack
● Linux, Virtualization, Proxmox
Please Ignore Negative Comments 🙂
[ad_2]
source