Skip to content

A macro for creating an S3 bucket for processing direct uploads with a Lambda function

Notifications You must be signed in to change notification settings

architect/macro-upload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

arc-macro-upload

Creates an S3 bucket for direct uploading and a Lambda function for processing direct uploads.

Add to your project

npm i @architect/macro-upload

And add to your .arc file:

@app
testapp

@http
get /
get /success

@macros
architect/macro-upload

Render the upload form

To render the upload form add the macro to any Lambdas you want to render the form. For the example .arc above:

cd src/http/get-index 
npm i @architect/macro-upload

And then in the function code:

let form = require('@architect/macro-upload/form')

exports.handler = async function http(req) {
  let headers = {'content-type': 'text/html; charset=utf8'}
  let redirect = `https://${req.headers.Host}/staging/success`
  let body = form({redirect})
  return {headers, body}
}

For a complete example see arc-example-macro-upload

About

A macro for creating an S3 bucket for processing direct uploads with a Lambda function

Resources

Security policy

Stars

Watchers

Forks

Packages

No packages published