A simple HTTP server in node.js.
var http = require('http');
var fs = require('fs');
var mySite = 'jonlabelle.com';
var myClient = http.createClient(80, mySite);
var myRequest = myClient.request('GET', '/', { 'host': mySite });
myRequest.end();
myRequest.on('response', function(response) {
console.log('STATUS: ' + response.statusCode);
console.log('HEADERS: ' + JSON.stringify(response.headers));
response.setEncoding('utf8');
response.on('data', function(chunk) {
fs.writeFile(mySite + '.html', chunk);
console.log('BODY: ' + chunk);
});
});