This is the code running in an aws lambda function.
exports.handler = (event, context, callback) => {
// TODO implement
mqfunc1(func2);
};
var func2 = function(data) {
console.log('got data: '+data);
};
var mqfunc1 = function(callback) {
var myCallback = function(data) {
console.log('got data: '+data);
};
var usingItNow = function(callback) {
callback('get it?');
};
};
Now I do get the the message which i want to print in the console. But I want to show the same message printed in the console using the callback function inside exports.handler.
I tried using callback function using various ways inside exports.handler but I am always getting null. I do understand that in a node js scripts all the function calls are asynchronous, so how do I return a value from any function and callback the same inside exports.handler, i.e. display the same in Execution result.