Skip to content

Commit

Permalink
protect route
Browse files Browse the repository at this point in the history
  • Loading branch information
slavingia committed Sep 27, 2024
1 parent 7bacd06 commit 26bd3a8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions middleware.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { clerkMiddleware, createRouteMatcher } from "@clerk/nextjs/server";

const isProtectedRoute = createRouteMatcher(["/dashboard(.*)"]);
const isProtectedRoute = createRouteMatcher([
"/dashboard(.*)",
"/api/generate-tests(.*)",
]);

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

export const config = {
matcher: ["/((?!.*\\..*|_next).*)", "/"],
matcher: ["/((?!.*\\..*|_next).*)", "/", "/api/generate-tests(.*)"],
};

0 comments on commit 26bd3a8

Please sign in to comment.