dynamic routes in middleware with next-auth
so i want to do dynamic routes using next-auth with the config varibe that middleware offers
This is what i have defined
i have tried doing something like this
i also tried defining it myself using a function but that didn't really work
5 Replies
This one works for me
looking at your example you have conflicting matchers...
This one matches all routes except /
This one matches all recipe routes
yeh right that makes sense, so i was thinking more dynamic routes as a recipe will look like this
/recipes/test123
and then a user can edit it when they go to /recipes/test123/edit
which is how i got thise here: /recipes/[id]/:path*
as i don't want to exclude the recipe itself but just the editing pageSolution
Ok ,then you can just expand on my example like so
this will match all routes like so /recipes/some-recipe-123/edit
the * matches anything else after it
meaning
will match
/recipes/123
and recipes/123/edit
and recipes/123/edit/123/something-else
Awesome thank you