Skip to content

Commit

Permalink
set public routes
Browse files Browse the repository at this point in the history
  • Loading branch information
bahiensed committed Jul 23, 2024
1 parent 7fbf290 commit 0d35947
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions middleware.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { clerkMiddleware, createRouteMatcher } from '@clerk/nextjs/server';

const isPublicRoute = createRouteMatcher(['/sign-in(.*)', '/sign-up(.*)', '/'])

export default clerkMiddleware((auth, req) => {
if (!isPublicRoute(req)) auth().protect();
});

export const config = {
matcher: ['/((?!.*\\..*|_next).*)', '/', '/(api|trpc)(.*)'],
};

0 comments on commit 0d35947

Please sign in to comment.