node.js belgesindeki here örneğine bakın.
http.get
yöntemi, kolaylık sağlayan bir yöntem olup, genellikle GET isteği için çok fazla temel malzeme ele alır; Aşağıda basit bir HTTP GET isteği nasıl yapılacağı bir örnektir.
var http = require("http");
var options = {
host: 'www.google.com'
};
http.get(options, function (http_res) {
// initialize the container for our data
var data = "";
// this event fires many times, each time collecting another piece of the response
http_res.on("data", function (chunk) {
// append this chunk to our growing `data` var
data += chunk;
});
// this event fires *one* time, after all the `data` events/chunks have been gathered
http_res.on("end", function() {
// you can use res.send instead of console.log to output via express
console.log(data);
});
});
En son dokümana bağlantı güncellendi, bu sayfa google sonuçlarıyla yüksek oranda döndürür. Yanıt yeterince büyükse, – blu
bu bellekte yemek yemiyor mu? Topları aldığınız yanıtları geri almak daha iyi olmaz mı? Bu mümkün mü? – chovy
Sadece bir isteği proxy yapıyorsanız, o zaman tercih edilen yöntem evet akışı olacaktır. –