Integration with node.js web site

Integration with node.js web site

traninvilelatraninvilela Posts: 2Questions: 1Answers: 0
edited September 2018 in Free community support

My .js SELECT query results the data some like this:

RowDataPacket {
id: 128,
cnpj: '00055671000150',
razao_social: '',
nome_fantasia: '',
tipo: '',
end_CEP: '',
end_logradouro: '',
end_numero: '',
end_complemento: '',
end_bairro: '',
end_municipio: '',
end_estado: '',
situacao_cadastral: '',
data_situacao: null,
motivo_situacao: '',
situacao_especial: '',
timestamp: 2018-09-25T18:27:41.000Z } ]

How i can load data in datable?

I'm using "Adminator Dashboard" (https://github.com/puikinsh/Adminator-admin-dashboard) and connect / select data using .js

db_conexao.js
var mysql = require('mysql');
var connection = mysql.createConnection({
host: "MY_HOST",
user: "MY_USER",
password: "*******",
database : 'DATABASE_NAME'
});

connection.connect();

connection.query('SELECT * FROM cnpj_OS_322014 LIMIT 0,2', function (error, results, fields) {
if (error) throw error;
console.log(results);
});

Replies

  • allanallan Posts: 63,457Questions: 1Answers: 10,465 Site admin

    The JSON shown in your first code block isn't valid. Could you send me a full and valid example of your JSON so I can suggest how it might be loaded please?

    Thanks,
    Allan

This discussion has been closed.