fix(01-02): move middleware.ts to src/ — required when project uses src/ directory
This commit is contained in:
1 parent
177403276b
commit
d6fc3e5ccf
1 file changed
@@ -0,0 +1,23 @@
|
||||
import { clerkMiddleware, createRouteMatcher } from "@clerk/nextjs/server";
|
||||
|
||||
const isPublicRoute = createRouteMatcher([
|
||||
"/sign-up(.*)",
|
||||
"/log-in(.*)",
|
||||
"/forgot-password(.*)",
|
||||
"/reset-password(.*)",
|
||||
"/verify-email(.*)",
|
||||
]);
|
||||
|
||||
export default clerkMiddleware(async (auth, request) => {
|
||||
if (!isPublicRoute(request)) {
|
||||
await auth.protect();
|
||||
}
|
||||
});
|
||||
|
||||
export const config = {
|
||||
matcher: [
|
||||
"/((?!_next|[^?]*\\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).*)",
|
||||
"/(api|trpc)(.*)",
|
||||
"/__clerk/(.*)",
|
||||
],
|
||||
};
|
||||
Reference in new issue
Block a user