1. Install Node.js from site : http://nodejs.org/

2. Open any text editor and write sample ‘Hello world’ code (as shown below)
Note: Instead of HTML, you can write plain text in ‘response.end()’. For this, you have to change the Content-type to ‘text/plain’.

Save the file with .js extension

var http = require(‘http’);
http.createServer(function (request, response) {
response.writeHead(200, {‘Content-Type’: ‘text/html’});
response.end(‘ <pre><html> <head><title>First Node.JS Program</title></head><body><div style=”color:red;”>Hello World\n </div></body></html></pre>‘);

}).listen(1337, ‘’);
console.log(‘Server running at i.e. localhost’);

3. After Installing, go to windows command prompt and go to the directory where you have saved the file. Write command ‘node filename-with-extension‘ (as shown below)

4. You will get the following message:

5. Open Chrome and type the above url: and here you go. Your HTML got executed!