I tried to create an object with data which I get from the DB I work with.
con.connect(function(err) {
if (err) throw err;
con.query("SELECT * FROM customers", function (err, result, fields) {
if (err) throw err;
console.log(result);
//creating an obj with a class i created
});
});
but I can`t return the object I created because it shows me it's undefined (it is returned to the "small" function I created in the brackets.
does someone have any idea of a solution for this problem?