uppy/examples/digitalocean-spaces
dependabot[bot] 14b10b02e3
build(deps): bump body-parser from 1.20.2 to 1.20.3 (#5462)
Bumps [body-parser](https://github.com/expressjs/body-parser) from 1.20.2 to 1.20.3.
- [Release notes](https://github.com/expressjs/body-parser/releases)
- [Changelog](https://github.com/expressjs/body-parser/blob/master/HISTORY.md)
- [Commits](https://github.com/expressjs/body-parser/compare/1.20.2...1.20.3)

---
updated-dependencies:
- dependency-name: body-parser
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-19 10:52:26 +02:00
..
.gitignore example: migrate digitalocean-spaces to ESM (#4015) 2022-08-22 17:17:41 +02:00
index.html meta: run Prettier on existing files (#4713) 2023-09-29 11:11:28 +02:00
main.js example: migrate digitalocean-spaces to ESM (#4015) 2022-08-22 17:17:41 +02:00
package.json build(deps): bump body-parser from 1.20.2 to 1.20.3 (#5462) 2024-09-19 10:52:26 +02:00
README.md meta: enable prettier for markdown (#5133) 2024-05-02 11:35:55 +02:00
server.cjs Merge branch main 2024-07-02 16:15:36 +02:00
setcors.xml examples: add CORS settings for DigitalOcean Spaces (#4428) 2023-04-26 10:02:21 +02:00

Uploading to DigitalOcean Spaces

This example uses Uppy to upload files to a DigitalOcean Space. DigitalOcean Spaces has an identical API to S3, so we can use the AwsS3 plugin. We use @uppy/companion with a custom endpoint configuration that points to DigitalOcean.

Running it

To run this example, make sure you've correctly installed the repository root:

corepack yarn install
corepack yarn build

That will also install the dependencies for this example.

First, set up the COMPANION_AWS_KEY, COMPANION_AWS_SECRET, COMPANION_AWS_REGION (use a DigitalOcean region name for COMPANION_AWS_REGION, e.g. nyc3), and COMPANION_AWS_BUCKET environment variables for @uppy/companion in a .env file. You may find useful to first copy the .env.example file:

[ -f .env ] || cp .env.example .env

To setup the CORS settings of your Spaces bucket in accordance with the plugin docs, you can use the example XML config file with the s3cmd CLI:

s3cmd setcors examples/digitalocean-spaces/setcors.xml "s3://$COMPANION_AWS_BUCKET"

Then you can start the dev server:

corepack yarn workspace @uppy-example/digitalocean-spaces start