I'm sening an id to a module checking if the message hjas been sent or not. After it has not been sent I 'm sending the message:
var l = require('./control.js')
sonuc = l.check(id);
And my module is
exports.check = function(id, callback){
try{
client.query("SELECT req FROM messages where req = 0 and id = "+id,
function (err, results, fields) {
if (results.length > 0){
callback(false);
}else{
callback(true);
}
});
callback();
}catch(err){
console.log(err);
}
}
But it's failing and returning undefined variable.