mirror of
https://github.com/DeveloLongScript/MHSF.git
synced 2026-05-07 18:34:59 -05:00
15 lines
449 B
TypeScript
15 lines
449 B
TypeScript
|
|
import { clerkMiddleware, createRouteMatcher } from "@clerk/nextjs/server";
|
||
|
|
import { NextRequest } from "next/server";
|
||
|
|
|
||
|
|
const isProtectedRoute = createRouteMatcher(["/account(.*)"]);
|
||
|
|
|
||
|
|
export default process.env.IS_AUTH == "true"
|
||
|
|
? clerkMiddleware((auth, req) => {
|
||
|
|
if (isProtectedRoute(req)) auth().protect();
|
||
|
|
})
|
||
|
|
: (request: NextRequest) => {};
|
||
|
|
|
||
|
|
export const config = {
|
||
|
|
matcher: ["/((?!.*\\..*|_next).*)", "/", "/(api|trpc)(.*)"],
|
||
|
|
};
|