Created
October 24, 2017 16:15
-
-
Save glennblock/5938d3137a112ab454cde769e8587660 to your computer and use it in GitHub Desktop.
This file contains 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
module.exports = createZeroCRMMiddleware; | |
function createZeroCRMMiddleware() { | |
return (req, res, next)=> { | |
const ctx = req.webtaskContext; | |
const compiler = ctx.compiler; | |
return compiler.nodejsCompiler(compiler.script, (error, webtaskFn) => { | |
if (error) return next(error); | |
compiler.script = (ctx, cb) => webtaskFn(ctx.body, ctx.secrets, cb); | |
return next(); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment