Integration with nod.js using js to SLECT in MySql
Integration with nod.js using js to SLECT in MySql
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);
});
Answers
Duplicate of this thread here - https://datatables.net/forums/discussion/52262/integration-with-node-js-web-site#latest, so closing