Getting Started With Node.js




Node.js is a javascript framework cum platform which is build on top of Google Chrome's Javascript v8 engine. Node.js is open source and totally free to use. 

 

Node.js is good for building applications which require high input / output such as real time chat apps, video streaming sites etc. 

 

Node.js apps are written on javascript and can run within Node,js runtime on either Linux, Windows or OS X.

 

Best part about Node.js is plug and play approach towards web development, where a huge liberary of ready made modules are available to use. 

 

Node.js is asynchronous and event drive. Basically that means it is non blocking in nature. So if a client requests some data from Node.js server, it wouldn't wait for that call to be completed, instead it will move on to the next call. 

Node.js is very fast when it comes to code execution. 

 

Node.js is used by large scale production grade applications. 

 

Installation 

You can download Node for your system from here : Download

 

To test if Node is installed, lets create our first app. 

Create a file called main.js. 

In main.js add :

console.log('hello world')

Now in the terminal type :

node main.js

 

 

Congrats you have just written your first node app. 

 

Now lets move on. 

In your main.js add following code :

 

Then in the terminal type :

node main.js

 

When you go to http://127.0.0.1:8081/, you will see our 'hello world message'

Now lets install Express. Express is a simple web framework for Node.js

You can install node by doing :

npm install express --save

 

Now in your main.js

 

 

 

Then when you will open port :3000 in browser, you will see something like :

 

 

Thats the basic of Node and express.

 

 



Increase Conversions Through Conversational Experiences

Sign Up For Contlo