O'Reilly logo
  • Василий Васильев thinks this is interesting:

01 var http = require('http');
02 var options = {
03   host: '127.0.0.1',
04   path: '/',
05   port: '8080',
06   method: 'POST'
07 };
08 function readJSONResponse(response) {
09   var responseData = '';
10   response.on('data', function (chunk) {
11     responseData += chunk;
12   });
13   response.on('end', function () {
14     var dataObj = JSON.parse(responseData);
15     console.log("Raw Response: " +responseData);
16     console.log("Message: " + dataObj...

From

Cover of Node.js, MongoDB, and AngularJS Web Development

Note

This is not an implementing of the http server. It's a client.