Answer the question
In order to leave comments, you need to log in
How to get value from Async function?
const getter = async () => {
let con;
try
{
con = await pool.getConnection();
rows = await con.query("SELECT * FROM table");
return await rows;
}
catch(err)
{
throw err;
}
finally
{
if(con)
{
return con.end();
}
}
};
socket.on('<имя события>', () =>{
console.log("\n\n\nВывод Query:");
getter().then((response_table) => console.log(response_table));
});
getter().then((response_table) => console.log(response_table))
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question