1var http = require('http');
2
3var options = {
4 host: 'google.com',
5 path: '/'
6}
7var request = http.request(options, function (res) {
8 var data = '';
9 res.on('data', function (chunk) {
10 data += chunk;
11 });
12 res.on('end', function () {
13 console.log(data);
14
15 });
16});
17request.on('error', function (e) {
18 console.log(e.message);
19});
20request.end();