Im new to node.
Im trying to fetch some results out of a MySQL table.
Currently at this state:
// from file a.js
class BlaBla {
getAll() {
const connection = this.mysql.createConnection(this.details);
connection.connect();
connection.query("SELECT * FROM todo", function(error, result, fields) {
// console.log(result) => gives correct output
return result;
});
connection.end();
}
}
// another file / module
const blaBla = new BlaBla();
blaBla.getAll() // returns undefined
What am i missing?