Skip to content

Commit 7374439

Browse files
committed
example(basic-example): Enable middleware by default
1 parent 4c54dfd commit 7374439

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

examples/basic/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ This basic example demonstrates how to use the `payload-authjs` plugin.
44

55
## Configuration
66

7-
- The authentication configuration is located in `src/auth.config.ts` and the NextAuth instance is created in `src/auth.ts`.
7+
- The Auth.js configuration is located in `src/auth.config.ts` and the NextAuth instance is created in `src/auth.ts`.
88
- In the Payload CMS configuration (`src/payload.config.ts`), we added the `payload-authjs` plugin.
9-
10-
The `middleware.example.ts` file demonstrates how to set up the middleware of Auth.js to be [edge-compatible](https://authjs.dev/guides/edge-compatibility). To use the middleware example, just rename the file to `middleware.ts`.
9+
- The middleware uses the authConfig from `src/auth.config.ts` to be [edge-compatible](https://authjs.dev/guides/edge-compatibility).
1110

1211
## Setup
1312

examples/basic/src/middleware.example.ts renamed to examples/basic/src/middleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ import { authConfig } from "./auth.config";
44
export const { auth: middleware } = NextAuth(authConfig);
55

66
export const config = {
7-
matcher: ["/((?!api|_next/static|_next/image|favicon.ico).*)"],
7+
matcher: ["/((?!api|_next/static|_next/image|favicon.ico|admin/login).*)"],
88
};

0 commit comments

Comments
 (0)