Still new to nodejs not sure what i am doing wrong here, i am trying to return a value from this function. However the variable i am trying to return outhjk is always reset.
function executeQuery( stmt, data ) {
var outhjk = "";
pool.connect(function(err, client, done) {
if(err) {
console.error('error fetching client from pool', err);
}
client.query(stmt, data, function(err, result) {
//call `done()` to release the client back to the pool
done();
if(err) {
return console.error('error running query', err);
}
outhjk = "just work please";
});
});
return outhjk;
}