I have the following code structure in exports.js
module.exports = {
getData:function(param1,param2,callback){
sql.query('SELECT users FROM table',function(error,result){
callback(null,result[0]);
});
}
}
And I called it from main file app.js file like
var common = require('./exports');
console.log(common.getData(null,null));
I got the following error
TypeError: callback is not a function
However I found a similar question here. But didn't fixed the problem. Any help would be appreciated..!
getData(null, null, <callback here>)you do not pass third argument.