Skip to content

Instantly share code, notes, and snippets.

@eduardoromero
Created January 17, 2019 05:32
Show Gist options
  • Save eduardoromero/50e7041c221adaa84e27df6a4f73d862 to your computer and use it in GitHub Desktop.
Save eduardoromero/50e7041c221adaa84e27df6a4f73d862 to your computer and use it in GitHub Desktop.
Lambda function with IOPipe
const iopipeLib = require('@iopipe/iopipe')
const tracePlugin = require('@iopipe/trace')
const iopipe = iopipeLib({
token: process.env.IOPIPE_TOKEN || '',
enabled: Boolean(process.env.IOPIPE_TOKEN),
plugins: [
tracePlugin({
autoHttp: true
})
]
})
let counter = 0
module.exports.handler = iopipe(async (event, context) => {
counter++
return {
statusCode: 200,
body: JSON.stringify({ counter })
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment