Skip to content

Instantly share code, notes, and snippets.

@dashmug dashmug/sample.js
Last active Jun 9, 2018

Embed
What would you like to do?
// 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
You can’t perform that action at this time.