-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmiddleware.js
28 lines (26 loc) · 890 Bytes
/
middleware.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//! CLERK AUTH RELATED
//? Created for blocking pages that require AUTH e.g. dashboard
import { authMiddleware } from "@clerk/nextjs";
//! NOTE: NEVER add the sign-in and sign-up route here.
//! Others, while signing in or signing up, the USER DASHBOARD will NEVER show up.
export default authMiddleware({
//? All routes that require PUBLIC access go in the below array
publicRoutes: [
"/",
"/products(.*)",
"/collections/tea",
"/collections/teaware",
"/search",
"/cart",
"/shipping",
"/checkout",
"/confirmation",
//! VERY IMPORTANT: You MUST add stripe related APIs added here. Or you wont be able to make requests to these endpoints on your frontend
//! These 2 endpoints are in the NextJS API file
"/api/stripe",
"/api/session",
],
});
export const config = {
matcher: ["/((?!.*\\..*|_next).*)", "/", "/(api|trpc)(.*)"],
};