Last active
June 9, 2018 21:36
-
-
Save dashmug/5cae542c111b2f9cd6d9c7ac3fff7b85 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
// Main API Lambda | |
async function (event) { | |
let input | |
let context | |
let response | |
try { | |
// input is simply the relevant input (not the whole | |
// AWS Lambda event which contains lots of unnecessary data) | |
const input = getInputFromEvent(event) | |
// Context will contain some useful info like user, requestId, etc. | |
const context = getContextInfo(event) | |
response = await doSomething(input) | |
// Broadcast to an SNS Topic | |
// publishToSNS is a wrapper function that publishes to SNS | |
// the input, context, and response | |
await publishToSNS(input, context, response) | |
} catch (err) { | |
throw new Error(err) | |
} | |
return response | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment