Skip to content

Commit

Permalink
protect route (anti-work#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
slavingia authored Sep 27, 2024
2 parents d198f8d + 553c37e commit af63a9b
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 af63a9b

Please sign in to comment.