1.0.1 • Published 4 years ago

@architect/macro-upload v1.0.1

Weekly downloads
4
License
Apache-2.0
Repository
-
Last release
4 years ago

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