Skip to content

Instantly share code, notes, and snippets.

@adamcrampton
Created April 23, 2019 04:37
Show Gist options
  • Save adamcrampton/eee887633f56ac5f9a3c4e7da12e7169 to your computer and use it in GitHub Desktop.
Save adamcrampton/eee887633f56ac5f9a3c4e7da12e7169 to your computer and use it in GitHub Desktop.
Boilerplate for Lambda function envoked from AWS API Gatewat
'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