Skip to content

djgovani/Serverless-S3-FileUpload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serverless REST API to Upload Image to S3 with offline support

This example demonstrates how to run a service locally, using the serverless-offline plugin.

Note

  • Change your bucket name and region in serverless.yml file.

Use-case

Test S3 image upload service locally, without having to deploy it first.

Setup

npm install
serverless offline start

Run service offline

serverless offline start

Usage

Upload Image to S3

http://localhost:3000/uploadImage

Using postman you can test it as shown in below:

Post request to upload image

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>"
    }
}

About

Serverless S3 file upload with offline support

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published