Node.js is the most popular server-side JavaScript environment available. It has the best cross-platform support for all Windows, OSX and Linux systems.

Let us first check Node’s definition.

Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

The main work of NodeJS is to execute JavaScript code on the server side in a non-blocking manner. Whenever the sever is waiting for some data or input, it doesn’t stops the execution of other code. Node makes use of callbacks for this purpose; which are executed automatically whenever the code that was blocking becomes available. It is also known as event programming.

Node is single-threaded i.e. there is only a single thread of execution at any given point of time. If that particular thread stops working, the server stops taking any more requests.

There are 2 main reasons for running JavaScript outside the browser on the server:

We can write a server that can handle web requests.
We can write command line scripts that can automate the tasks.

Related Posts

Leave a Reply