NodeJs Hello World Project

HelloWorld Example 


* nodeJS is JavaScript-based framework/platform built on Google Chrome V8 Engine.
* It is used to develop I/O intensive web application 
* like video streaming sites, sigle-page application. 
var http = require("http");
http.createServer(function(request, response){
 response.writeHead(200, {'Content-Type': 'text/plain'});
 response.end('Hello World\n');
console.log("Server is running on http://localhost:8080/");

Command to start server

node main.js


NPM Install Proxy

Proxy Configuration NPM Command

Npm Command to set proxy configuration.

npm config set proxy http://login:pass@host:port
npm config set https-proxy http://login:pass@host:port
npm config set http-proxy http://login:pass@host:port
npm config set registry ""
npm config set strict-ssl false

The configuration is stored in <User Folder>/.npmrc


proxy = http://login:pass@host:port
https-proxy = http://login:pass@host:port
strict-ssl = false
http_proxy = http://login:pass@host:port
registry =



JQuery provide various libraries for Client-Side Javascript Web Application.

  • JQuery, a Document Object Model (DOM) Manipulation Library
  • JQuery UI, a User Interface Interaction Library
  • JQuery Mobile, a Mobile Touch Library
  • QUnit, a Test Framework

Example List


$() Function

It would return  a collection of matched element found in DOM based on passed argument or created by passing HTML String.

The below is a html. The h1 tag is identified with id, example. $() Function would be used to retrieve the DOM element.

    <h1 id='example'>Example</h1>

It would return the element whose id is example.



It enable new method can be added to Jquery object. The below example show a JQuery Plugin named “plugin".

$.fn.plugin= function() {
  console.log("plugin called")

$( "a" ).plugin();



Javascript OOP


JavaScript is Prototype-baed Programming Language. Prototype-based Programming is a Object-oriented Programming Model which the inheritance is performed through reuse of existing object (prototype).



Namespace is a container which bundle up functionality. In JavaScirpt, it is just an object containing methods, property and objects.



JavaScript uses functions as constructors for classes. Defining a function is to define a class in JavaScript.

var Student = function(){


var student1 = new Student();



The properties of function is defined through the keyword, this.

var Student = function(name){ = name;

var student1 = new Student("Tester");



Declared method to a class in JavaScript is just to add method to object prototype but not object. There methods would be assigned to prototype property of a function.

var Student = function(name){ = name;

Student.prototype.getName = function(){

var student = new Student("tester");



jsPlumb Example

What is JsPlumb?

It is a library to provide connectivity between DOM element in browser.

Home page:


Display in Browser



Sample Code

<style type="text/css">
#container0, #container1 {
float: left;
height: 100px;
width: 100px;
border: 1px solid black;
margin: 10px;
 jsPlumb.ready(function() {
 var e0 = jsPlumb.addEndpoint("container0"),
 e1 = jsPlumb.addEndpoint("container1");
 jsPlumb.connect({ source:e0, target:e1 }); 
 </body> </html>