@codegenie/serverless-express
Version:
This library enables you to utilize AWS Lambda and Amazon API Gateway to respond to web and API requests using your existing Node.js application framework.
28 lines (23 loc) • 522 B
JavaScript
const getRequestValuesFromStepFunctions = ({ event }) => {
const method = 'POST'
const headers = { host: 'stepfunctions.amazonaws.com' }
const body = event
return {
method,
headers,
body
}
}
const getResponseToStepFunctions = ({
body,
isBase64Encoded = false
}) => {
if (isBase64Encoded) {
throw new Error('base64 encoding is not supported')
}
return JSON.parse(body)
}
module.exports = {
getRequest: getRequestValuesFromStepFunctions,
getResponse: getResponseToStepFunctions
}