I am trying to perform a mysql query asyncronously assigning a value to a const to be later used in my code.
What I have so far is:
const plan_free = await con1.promise().query("SELECT stripe_price1 FROM funzioni WHERE titolo='SmartBanca'")
.then( ([rows,fields]) => {
return rows[0]['stripe_price1'];
})
.catch(console.log)
.then( () => con1.end());
console.log("Plan_free: "+ plan_free);
but plan_free returns [object Object]. I am sure I am close to the goal but I don't get what I am still doing wrong.
Edit: by adding the following lines:
plan_free1 = JSON.stringify(plan_free);
console.log("Plan_free: "+ plan_free1);
I see the following content for plan_free:
Plan_free: {"_events":{},"_eventsCount":0,"next":null}
that actually is not even close to what I want to achieve.