Effortless Protected Routes In Next.js Using Middleware

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Man, thank you for this tutorial! I was stuck for hours trying to figure out why my middleware wasn't working. I had placed the middleware file in the app folder and tried debugging it, but nothing worked. Then, I found your video and learned to place the middleware outside the app folder—and it worked!

cesarpizarra
Автор

short and understable! without any unnecessary things! thanks man!!

sandrotabatadze
Автор

This was just what I needed. Thank you very much. Simple and easy to understand.

marie-elizeventer
Автор

No bs with an example and straight to the point. Thank you!

zb
Автор

I have been loosing sleep trying to run some middleware with token auth and this is just what I needed thank you very much! From: a self learning developer.

Keeptheflameband
Автор

So straight forward and easy to understand. Thank you

samnmeje
Автор

Man you are a saver. I have wasted so much time on this and you explained it so well. I was stuck due to middleware being in the app folder. Thank you!😄

yushankkashyap
Автор

Thanks for doing this video Ryan. I was stuck on this for 2 days lol

csdevelops
Автор

how do i make it dynamic? without changing user manually in middleware

hankersoree
Автор

Thank you so much. Very clean and this is what I needed!

MuhamadAzizPrasetyo
Автор

Hey, i like this, so easy to make, thanks bro, greetings from Argentina.

joze.rios
Автор

This is a really helpful compliment their docs. Thank you!!

tigana
Автор

thanks a lot man, simple and efficient <3

AHMED-dlhn
Автор

If you have a src folder, try placing it in there. My middleware didn't run until I did that.

tigana
Автор

This was very helpful indeed to understand how we can protect the routes. But I have a doubt here, if the user is already authenticated, he should be navigated to the mainPage instead of signIn page. We can write a condition for that here and add signIn page to the matcher but wouldn't it make the middle ware run infinitely because it will rerun the mainPage because user exists?

rahulram
Автор

If I have a middleware with localization and a middleware with route protection, how do I make different configurations for the application?

MrSeredan
Автор

Super helpful! Thanks for creating this

fabio
Автор

Really helpful better than the HOC approach

israelzorzor
Автор

what if i want to have multiple middleware functions? where would they go since we have only one middlware.js file and one export for config

minhaz
Автор

Middleware making the routing slower, any solution?

devrano