i want to get data from database and array-loop That's my actual structure. I have already test a tons of things without success
app.get('/url' async (req,res)=> {
value = []
async function myFunction(){
myArray.map(async(data)=> {
db('MY QUERY')
.then((res)=> {
value.push(res)
})
})
}
await myFunction()
console.log(value) // Always empty
})
I'm open to any tips from you ! :)
EDIT : More information about database connection:
myArray is like : ["a","*","b","myOwnMathFunction(a)"] but not important here
Query : "SELECT * FROM User WHERE id='1' "
//Verified & work
const bd = mysql.createConnection({ MY CONFIG})
const db = util.promisify(bdd.query).bind(bdd)