Hi,
I have a function that should retrieve data from the database and then process and return it. The function is however skipping the query and returning undefined.
This is the query:
function getUser(name) {
client.query(`SELECT * FROM users WHERE name=? LIMIT 1`, [name]).then(data => {
// I want it to process and return the user data
})
// But it skips the query and returns undefined
}
function getUser(name) {
client.query(`SELECT * FROM users WHERE name=? LIMIT 1`, [name]).then(data => {