Created
April 23, 2019 04:37
-
-
Save adamcrampton/eee887633f56ac5f9a3c4e7da12e7169 to your computer and use it in GitHub Desktop.
Boilerplate for Lambda function envoked from AWS API Gatewat
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
'use strict'; | |
console.log('Getting JSON...'); | |
exports.handler = async (event) => { | |
let templateId = 1; | |
let responseCode = 200; | |
console.log('request:' + JSON.stringify(event)); | |
if (event.queryStringParameters && event.queryStringParameters.templateId) { | |
templateId = event.queryStringParameters.templateId; | |
} | |
if (event.body) { | |
let body = JSON.parse(event.body); | |
} | |
let responseBody = { | |
message: 'test: ' + templateId, | |
input: event | |
}; | |
let response = { | |
statusCode: responseCode, | |
body: JSON.stringify(responseBody) | |
}; | |
console.log("Response: " + JSON.stringify(response)); | |
return response; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment