This example demonstrates how to run a service locally, using the serverless-offline plugin.
- Change your
bucket name
andregion
inserverless.yml
file.
Test S3 image upload service locally, without having to deploy it first.
npm install
serverless offline start
serverless offline start
http://localhost:3000/uploadImage
Using 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>"
}
}