|
há 1 ano atrás | |
---|---|---|
.. | ||
public | há 1 ano atrás | |
README.md | há 1 ano atrás | |
index.js | há 1 ano atrás | |
package.json | há 1 ano atrás |
A simple and fully working example of Uppy and AWS S3 storage with Node.js (and Express.js). It uses presigned URL at the backend level.
It's assumed that you are familiar with AWS, at least, with the storage service (S3) and users & policies (IAM).
These instructions are not fit for production but tightening the security is out of the scope here.
aws-nodejs
). {
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicAccess",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::aws-nodejs/*"
}
]
}
[
{
"AllowedHeaders": ["*"],
"AllowedMethods": ["GET", "PUT", "HEAD", "POST", "DELETE"],
"AllowedOrigins": ["*"],
"ExposeHeaders": []
}
]
You may use existing AWS credentials or create a new user in the IAM page.
~/.aws/credentials
.PutObject
and PutObjectAcl
permissions.{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": ["s3:PutObject", "s3:PutObjectAcl"],
"Resource": "arn:aws:s3:::aws-nodejs/*"
}
]
}
Download this code or clone repository into a folder and install dependencies:
CYPRESS_INSTALL_BINARY=0 corepack yarn install
Add a .env
file to the root directory and define the S3 bucket name and port
variables like the example below:
COMPANION_AWS_BUCKET=aws-nodejs
COMPANION_AWS_REGION=…
COMPANION_AWS_KEY=…
COMPANION_AWS_SECRET=…
PORT=8080
N.B.: This example uses COMPANION_AWS_
environnement variables to facilitate
integrations with other examples in this repository, but this example does not
uses Companion at all.
Start the application:
corepack yarn workspace @uppy-example/aws-nodejs start
Dashboard demo should now be available at http://localhost:8080.
You have also a Drag & Drop demo on http://localhost:8080/drag.
Feel free to check how the demo works and feel free to open an issue.