Next.js Discord

Discord Forum

defining middleware based on route groups

Unanswered
Basque Shepherd Dog posted this in #help-forum
Open in Discord
Basque Shepherd DogOP
is it possible to set up a clerk middleware to find out if a route belongs to a certain route group in next js?

I want to have a file structure like this:

(public)/
  L page1/page.ts
  L page2/page.ts
  ...
(protected)/
  L page3/page.ts
  ...

as far as I know, the route groups are completely transparent so im not sure if there is a way to automatically set up the middleware to authenticate anything behind the (proteccted) group.

1 Reply

not possible unfortunately