Node.js Introduction

      No Comments on Node.js Introduction

Why Node.js??

With introduction of Node.js , javascript has become more powerful. Now, complete application (server side code as well as client side code) can be developed using javascript. It is getting widely used in IT industry and is in great demand in market.

There are several reasons why Node.js is being preferred :

1. Node.js uses Asynchronous Programming i.e. It does not wait for the result after it makes a call to server.

2. Node.js uses an event-driven programming i.e. ther server would react only when the event occurs.

3. Node.js uses non-blocking I/O model.

4. Node.js allows javascript to run on the server. Hence, it can be used as a Server-side programming as well.

5. Node.js provides many ready to use modules which can be used for different functionalities.

6. Node.js helps in building lightweight, efficient and scalable applications.

7. Node.js is open source server environment.

8. Node.js can run on various platforms e.g. linux, windows,mac,unix etc

What does Asynchronous Programming mean in Node.js????

Let us understand Asynchronous Programming through an example.

Normally in Java where Synchronous Programming is used, flow of control is as below:
1. Send a request to server.
2. Wait for the reply from Server.
3. Once reply is obtained from Server, then read it show to client.

Now, in Node.js which uses asynchronous programming, does the following :

1. Send a request to server.
2. Take the next request from clients and send to server.
3. Whenever reply is obtained from Server, then read it show to client.

We can see from the above explanation that, in asynchronous programming, Client does not wait for the Server response. Rather it proceeds with next request to server and whenever the server responds to the respective sent query, it reads and displays to clients. This helps in making the application more efficient and scalable.

Leave a Reply