I'm trying to set a variable to a function that returns a boolean. However, I can't seem to achieve this. Is this where you use async functions?
Here is my code: (NodeJS)
function getNumbers() {
return client.query(query, (error, result) => {
if (error) {
console.log(error)
return false
} else if (result.rows.length) return true
else return false
})
}
app.post('/receiveSMS', (request, response) => {
let doesUserExist = getNumbers()
console.log(doesUserExist)
}
The output that I get when console logging is undefined.
Thanks for the help!