ノードjsでHTTP getを使用してサイトからデータをインポートする方法を学ぶのに問題があります。 GETは、戻されたルートJSONオブジェクトのキーに含まれるオブジェクトの配列にアクセスします。get Node jsを使用してオブジェクトデータをインポートする
私を混乱させる2つのことは、このプロセスでクエリキーを使用する方法/ getが返す配列情報に対処する方法またはアクセスする方法です。次のようにおかげでたくさん
私のコード今のところです:
var http = require('http');
var options = {
host: 'site',
path: 'path'
};
callback = function(response) {
var str = '';
//another chunk of data has been recieved, so append it to `str`
response.on('data', function (chunk) {
str += chunk;
});
//the whole response has been recieved, so we just print it out here
response.on('end', function() {
console.log(str);
});
}
http.request(options, callback).end();