0
我寫了下面的代碼的NodeJS從網站的NodeJS:HTTP GET返回代碼,而不是
var http = require('http');
var url = {
host: 'www.sample-website.com',
headers: {
"Accept": "application/json",
'Content-Type': 'application/json'
},
};
http.get(url, function(obj) {
var output = "";
for (property in obj) {
output += property + obj[property] ;
}
console.log(output);
})
但是作爲迴應,我得到了一些代碼(某種事件的檢索JSON對象JSON對象.js代碼),我不明白(不是HTML代碼)。需要幫助搞清楚我要去哪裏錯了
包括對參考片段::
// emit removeListener for all listeners on all events
if (arguments.length === 0) {
for (key in this._events) {
if (key === 'removeListener') continue;
this.removeAllListeners(key);
}
this.removeAllListeners('removeListener');
this._events = {};
return this;
}
只是一個友善的建議,請使用要快的框架或連接 – binariedMe