-2
私のNode.jsコード:データベースコンテンツをブラウザでどのように表示するか?
http.createServer(function (request, response)
{
console.log('Creating the http server');
connection.query('SELECT * FROM navd_compare LIMIT 100', function(err, rows, fields)
{
console.log('Connection result error '+err);
console.log('no of records is '+rows.length);
response.writeHead(200, { 'Content-Type': 'application/json'});
response.end(JSON.stringify(rows));
response.end();
});
}).listen(8084);
問題は何ですか? 最初に使用しないでください.end 2回 –
ここで/ howは 'connection'を定義していますか? – Indent
ブラウザでJSON出力を取得していますが、テーブルに入れたいです。どのように各行のデータROMデータベースを取得するには?それをjsオブジェクトに変換してブラウザに出力します。 –