node-host icon indicating copy to clipboard operation
node-host copied to clipboard

can't make http.get to work

Open rafaelcastrocouto opened this issue 13 years ago • 1 comments
trafficstars

Am i doing something wrong?

var http = require('http'), url = require('url'); exports.app = function(req, res){ var options = {
host: 'www.google.com',
port: 80,
path: '/'
};
http.get(options, function(r) {
var data = ''; r.on('data', function(chunk) {
data += chunk;
});
r.on('end', function() {
res.end(data);
});
}).on('error', function(e) {
res.end("Got error: " + e.message);
});

}

rafaelcastrocouto avatar Mar 01 '12 12:03 rafaelcastrocouto

hey did u figure it out...how to do

js08 avatar Sep 29 '14 16:09 js08