Skip to content

Instantly share code, notes, and snippets.

@icodeforlove
Created May 2, 2011 23:26
Show Gist options
  • Save icodeforlove/952564 to your computer and use it in GitHub Desktop.
Save icodeforlove/952564 to your computer and use it in GitHub Desktop.
node.js basic http.get request
var http = require('http');
http.get(
{
host: 'chadscira.com',
port: 80,
path: '/'
},
function(response) {
var data = '';
response.on('data', function (chunk) { data += chunk; });
response.on('end', function () { console.log(data); });
response.on('error', function (e) { console.log("Got error: " + e.message); });
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment