Skip to content

Commit ffc5a45

Browse files
committed
example(basic-example): Add README and add note about middleware example
1 parent 1d48a45 commit ffc5a45

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

examples/basic/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
11
# Basic Example
2+
3+
This basic example demonstrates how to use the `payload-authjs` plugin.
4+
5+
## Configuration
6+
7+
- The authentication configuration is located in `src/auth.config.ts` and the NextAuth instance is created in `src/auth.ts`.
8+
- 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`.
11+
12+
## Setup
13+
14+
1. Rename the `.env.example` file to `.env` and update the values with your secrets.
15+
2. Install dependencies: `pnpm install`
16+
3. Start the development server: `pnpm run dev`
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import NextAuth from "next-auth";
22
import { authConfig } from "./auth.config";
33

4-
const { auth: middleware } = NextAuth(authConfig);
5-
export default middleware;
4+
export const { auth: middleware } = NextAuth(authConfig);
65

76
export const config = {
87
matcher: ["/((?!api|_next/static|_next/image|favicon.ico).*)"],

0 commit comments

Comments
 (0)