Skip to content

Commit 812044c

Browse files
authored
doc: Update the code example to use the correct App Router syntax (#189)
1 parent 8d77788 commit 812044c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

packages/docs-site/src/pages/other-providers.mdx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This guide will show you how to use next-S3-upload with non-AWS providers.
88

99
First, customize the API route to use the access keys, bucket, region, and endpoint provided by your host. For example, a Digital Ocean Spaces setup may look something like this.
1010

11+
### Pages router
1112
```js
1213
// pages/api/s3-upload.js
1314
import { APIRoute } from "next-s3-upload";
@@ -21,6 +22,20 @@ export default APIRoute.configure({
2122
});
2223
```
2324

25+
### App router
26+
```js
27+
// app/api/s3-upload/route.js
28+
import { POST as APIRoute } from "next-s3-upload/route";
29+
30+
export const POST = APIRoute.configure({
31+
accessKeyId: process.env.DIGITAL_OCEAN_SPACES_KEY,
32+
secretAccessKey: process.env.DIGITAL_OCEAN_SPACES_SECRET,
33+
bucket: "name-of-bucket",
34+
region: "us-east-1",
35+
endpoint: "https://nyc3.digitaloceanspaces.com"
36+
});
37+
```
38+
2439
The configuration values used here will be different for everyone. Please refer to your provider's documentation for the correct values.
2540

2641
Also, don't forget to setup environment variables for the API keys.

0 commit comments

Comments
 (0)