Saturday, March 31, 2012

Installing Node.js on windows







Download Node.js setup from http://nodejs.org/# and install it.


  1. Type up the following hello.js in your favorite editor
    var http = require('http');
    
    http.createServer(function (request, response) {
      response.writeHead(200, {'Content-Type': 'text/plain'});
      response.end('Hello World\n');
    }).listen(8080);
    
    console.log('Server running at http://127.0.0.1:8080/');
  2. Run
    node hello.js
  3. You’ll see Hello World printed when you visit http://localhost:8080


No comments: