Prøv at bruge async/wait syntaks for at få dine resultater
const mysql = require('mysql'); // or use import if you use TS
const util = require('util');
const conn = mysql.createConnection({
host: config.config.mysql.opencart_local.host,
user: config.config.mysql.opencart_local.user,
password: config.config.mysql.opencart_local.password,
database: config.config.mysql.opencart_local.database
});
var current_products = [];
//
var query_current_products = 'select * from table;';
(async function getProducts () => {
try {
const rows = await query( query_current_products);
console.log(rows);
current_products=rows;
} finally {
conn.end();
}
})()