Created
November 17, 2016 19:06
-
-
Save cassiozen/9e5f98812f44e0acf0b3ec011869e394 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports.requestUploadURL = (event, context, callback) => { | |
var s3 = new AWS.S3(); | |
var params = JSON.parse(event.body); | |
var s3Params = { | |
Bucket: 'slsupload', | |
Key: params.name, | |
ContentType: params.type, | |
ACL: 'public-read', | |
}; | |
var uploadURL = s3.getSignedUrl('putObject', s3Params); | |
callback(null, { | |
statusCode: 200, | |
headers: { | |
'Access-Control-Allow-Origin': 'https://www.my-site.com' | |
}, | |
body: JSON.stringify({ uploadURL: uploadURL }), | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In your CLI, run the command,
serverless info