Skip to content

Commit

Permalink
doc: Update the code example to use the correct App Router syntax (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
centsent authored Dec 5, 2024
1 parent 8d77788 commit 812044c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/docs-site/src/pages/other-providers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This guide will show you how to use next-S3-upload with non-AWS providers.

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.

### Pages router
```js
// pages/api/s3-upload.js
import { APIRoute } from "next-s3-upload";
Expand All @@ -21,6 +22,20 @@ export default APIRoute.configure({
});
```

### App router
```js
// app/api/s3-upload/route.js
import { POST as APIRoute } from "next-s3-upload/route";

export const POST = APIRoute.configure({
accessKeyId: process.env.DIGITAL_OCEAN_SPACES_KEY,
secretAccessKey: process.env.DIGITAL_OCEAN_SPACES_SECRET,
bucket: "name-of-bucket",
region: "us-east-1",
endpoint: "https://nyc3.digitaloceanspaces.com"
});
```

The configuration values used here will be different for everyone. Please refer to your provider's documentation for the correct values.

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

0 comments on commit 812044c

Please sign in to comment.