Skip to content

trigaut/Serverless-React-Upload-Example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

File upload example with Serverless, AWS, React and Antd

This repository is an example of application for the serverless stack S4. It contains a small React app with an Uploads component, wrapping Ant design Upload component, to safely upload/download files to/from an Amazon S3 Bucket using S4 as a backend.

Requirements

Quick start

  • Clone this repository
  • Run the following command at the root of the project to download S4 repository in the backend folder
sls create --template-url https://github.com/theodo/S4 --path backend
  • Run yarn in the backend folder

  • Import the four lambdas in the examples/allowMe folder at the begining of the serverless.ts file

import {
  requestUploadToken,
  getDownloadUrl,
  listFiles,
  onFileUploaded,
} from "./examples/allowMe/functions/config";
  • Add them in the functions attributes of the serverlessConfiguration
functions: {
    getSignedUploadUrl,
    getSignedDownloadUrl,
    dispatchFileUpload,
    requestUploadToken,
    getDownloadUrl,
    listFiles,
    onFileUploaded,
  },
  • Run yarn sls deploy --aws-profile YOUR_PROFILE in the backend folder to deploy S4

  • Create a .env file in the frontend folder containing

REACT_APP_API_BASE_URL=https://{API_GATEWAY_ID}.execute-api.{REGION}.amazonaws.com/api
  • Run yarn start in the frontend folder

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published