NodeJs + Mysql query execution too late (delays) https://github.com/mysqljs/mysql
Hello guys, I need help with mysql js, when I do .query(); the callback always delaying and gives me empty result but if I put timer it will give me the results, how do we fix the issue... on their documentation says this "Every method you invoke on a connection is queued and executed in sequence." so they using async i believe, anyone know how to wait for the results before sending data back to client side? I tried Promise, Async/Await but they using something else to stock up their queries..
con.query(`SELECT * FROM users`,
function(err, data) {
// this callback always delays 4 seconds, this callback executes straight away without waiting.
return data;
}
);