Skip to content

Instantly share code, notes, and snippets.

@coreylight
Created February 20, 2018 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coreylight/f75fe18e0189e47f661d16e2a28d72e9 to your computer and use it in GitHub Desktop.
Save coreylight/f75fe18e0189e47f661d16e2a28d72e9 to your computer and use it in GitHub Desktop.
Example for claudia.js
// app business logic code here
const {context} = require('./context');
module.exports = () => {
// I'm inside a single lambda invocation!
context.iopipe.log('wow');
}
let currentContext;
exports.setContext = (ctx) => {
currentContext = ctx;
}
exports.context = currentContext;
const {setContext} = require('./context');
const iopipe = require('@iopipe/iopipe')({
token: 'XYZ'
});
const newProxyRouterFn = api.proxyRouter.bind({});
api.proxyRouter = iopipe((event, context) => {
setContext(context);
return newProxyRouterFn(event, context);
});
module.exports = api;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment