I need to get all results synchronized and append to a string with async/await keywords like c#
I am new to node.js and i can not adapt this new syntax to my code.
var string1;
var string2;
var string3;
var string4;
DatabasePool.getConnection(function(err, connection) {
connection.query(query,function (err, result) {
if (err){};
string1 = result;
});
connection.query(query,function (err, result) {
if (err){};
string2 = result;
});
connection.query(query,function (err, result) {
if (err){};
string2 = result;
});
connection.query(query,function (err, result) {
if (err){};
string2 = result;
});
// i need to append all these strings to appended_text but
// all variables remain blank because below code runs first.
var appended_text = string1 + string2 + string3 + string4;
});
via Burc Hasergin
No comments:
Post a Comment