Skip to content

Instantly share code, notes, and snippets.

@glennblock
Created October 24, 2017 16:15
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 glennblock/5938d3137a112ab454cde769e8587660 to your computer and use it in GitHub Desktop.
Save glennblock/5938d3137a112ab454cde769e8587660 to your computer and use it in GitHub Desktop.
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