Get up and running with a Node.js webserver for your web application or working website by following these simple steps. I will share a script.js file which contains the script we are going to work in this little tutorial.

First of all go to nodejs.org/download/‎ and install Node.js by downloading its executable setup.
After you have installed make a new folder or select your existing folder where you want your web app to reside.
You will need to install two Node.js modules for a nice experience. One is Nodemon and other of course well-known Node.js based implemented webserver Express, because we do not want to reinvent the wheel.

Nodemon – Monitor for any changes in your node.js application and automatically restart the server – perfect for development.

Express is a minimal and flexible node.js web application framework, providing a robust set of features for building single and multi-page, and hybrid web applications. We will be using its simple HTTP features.

Open cmd (commond prompt) go into the directory of your work and writenpm install nodemon -g //it will install the nodemon module.
npm install express //it will install express web server module in this directory, we are not installing it for global use.

Configuring web server:app.configure(function() {
app.set('port',3000);
app.use(express.static(__dirname + '/public'));
});server will look the public directory as a http serving directory. If your script.js file will reside in the same directory as your index.html file, for example then change the directory to ‘/’ only.

Starting the server:httpServer.listen(app.get('port'),function(){
console.log("Express server listening on port %s.",httpServer.address().port);
});
Now go to the command prompt and writenodemon script.js
it will run script.js as well start monitoring for any changes in the directory. Whenever you make any changes to any file just press Ctrl+S and the webserver will refresh these changes.

Now you have a simple webserver running you can continue your development of a web app.