S3-Presigned-Urls-Vercel-Serverless
Setup
yarn install && yarn setup
Run(Local)
yarn start
You need to set environment variables with os.setenv
for local development.
Deploy
yarn deploy
ENV
BUCKET_NAME=""
BUCKET_REGION=""
ACCESS_KEY_ID=""
SECRET_KEY=""
Note that .env
file will not work. You need to set environment variables in vercel, and use it with os.getenv
.
Example
const res = await fetch(url, {
method: 'POST',
body: JSON.stringify([
{
"userId": "example1",
"fileName": "1.txt"
},
]),
});
await res.json(); // ["some url for 1.txt"]