app.get('/someApi', async (req, res) => {
var a = await SomeMethod();
})
function SomeMethod()
{
let sql = 'SELECT * FROM someTable'
var query = db.query(sql, (err, results) =>{
if(err)
{
throw err
}
if(results ... some logic)
{
return true;
}
else{
return false;
}
})
}
If i call SomeMethod from someApi it will pass the line and say that var a = undefined instead of true or false. I need to get a response, true/false before going to next line after var a in someApi.