UNPKG

joule

Version:

Node implementation of Mule for creating REST services

14 lines (12 loc) 502 B
module.exports.customFunction = function (req, res, callback) { // Use setTimeout to prove that async function calls work within the framework setTimeout(function(){ console.log('in custom function'); res.setVariable('myVar', 'this is a test'); callback(req, res); }, 1000); } module.exports.errorHandler = function (req, res, err) { console.error("In custom error handler\n" + err.stack); res.status(500).send("In custom error handler: " + err.message); }