19 Dec 2013

Setup your workstation for Node.js / Getting started with Node.js


First things first, Install Node.js from Node.js website. The installer should install the Chrome's JavaScript runtime along with Node.js framework on your system and even setup environment variables.

How to check if node.js is installed and ready to be used ?
Go to the command prompt and write command "node" , it should get recognized a ">" line prompt should appear, as shown below

Lets now make out first example to understand Node.js. Lets take a problem statement where we want to create a web application which has a single page, when we hit that page from the browser, it should say "Hello World".

Lets now create a file hello.js, write the below code in the hello.js file

var http = require('http');
http.createServer(function (req, res) {
res.end("Hello World");
console.log('Server running at');

To run the application, go to the command prompt and type "node hello.js

Now go to your browser and hit the url '', this would simply show you a web page with "Hello world" as simple response.

Thats it, your first node.js application is ready.

Written by

We are Creative Blogger Theme Wavers which provides user friendly, effective and easy to use themes. Each support has free and providing HD support screen casting.


Post a Comment


© 2013 NimbleGeek. All rights resevered. Designed by Templateism

Back To Top