This example demonstrates how to run a service locally, using the serverless-offline plugin.
- Change your
bucket nameandregioninserverless.ymlfile.
Test S3 image upload service locally, without having to deploy it first.
npm install
serverless offline startserverless offline starthttp://localhost:3000/uploadImageUsing postman you can test it as shown in below:
Response:
{
"message": "Image uploaded",
"data": {
"ETag": "\"<ETag>\"",
"Location": "https://<Your_Bucket_Name>.s3.<Your_Region>.amazonaws.com/<Uploaded File with path>",
"key": "<Uploaded File with path>",
"Key": "<Uploaded File with path>",
"Bucket": "<Your_Bucket_Name>"
}
}