How to setup my middleware
Answered
Bucovina Shepherd Dog posted this in #help-forum
Bucovina Shepherd DogOP
Hey all. I am pretty new to next js. I am trying to setup my middleware to protect the /generator route from unauthorized users. How would i do this? Ive tried using docs and gpt but it didn't really give me anything
5 Replies
Bucovina Shepherd DogOP
Right now my middleware looks like this. This is a template from supabase docs
Someone told me i could protect my route inside my /generator/page.tsx file to escape troubles
@Bucovina Shepherd Dog Right now my middleware looks like this. This is a template from supabase docs
In matcher, just add “/generator”
Answer
And check the auth status in middleware function
If you don’t want to protect the added routes, remove it