I am new to node.js , and use ari client. I have two .js files that first one is required in second one. I have declared a variable in second one that must contain return value of first file but console.log(variable) is undefined although in first file return value is not null.
in first file :
var db = require("./database.js");
var service_info = db.select(connection,'select * from services where ivr_shortcode = ?',service);
console.log(service_info);
service_info is undefined;
in second file :
this.select = function (connection,query,data){
connection.query(query,[data],function(err, results){
if(err)
{
throw err;
}
else
{
return results;
}
});}