Created
February 20, 2018 16:44
-
-
Save coreylight/f75fe18e0189e47f661d16e2a28d72e9 to your computer and use it in GitHub Desktop.
Example for claudia.js
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
// app business logic code here | |
const {context} = require('./context'); | |
module.exports = () => { | |
// I'm inside a single lambda invocation! | |
context.iopipe.log('wow'); | |
} |
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
let currentContext; | |
exports.setContext = (ctx) => { | |
currentContext = ctx; | |
} | |
exports.context = currentContext; |
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
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