Node.js is an open-source and cross-platform JavaScript runtime environment. It is incredibly performant since it runs on the chromium V8 javascript engine.
A Node.js app runs in a single process, without creating a new thread for every request. Node.js provides a set of asynchronous I/O primitives in its standard library that prevent JavaScript code from blocking and generally, libraries in Node.js are written using non-blocking paradigms, making blocking behavior the exception rather than the norm. Says the official website for node.js. But what does it mean?
The event loop
Basically, Nodejs uses something called an event loop. Now, if you have never heard about an event loop, I should warn you because it can be extremely confusing to grasp the concept of an event loop initially. However, let me assure you that the fundamental concept itself is really simple. For almost every program, there are input and output (or I/O) operations. These operations are not instantaneous. For example, when a user is prompted to input something, usually the program comes to a halt to retrieve that input. And only after the input is retrieved should the program continue. Likewise, the output is also the same even though it might seem instantaneous. The program sends a buffer to a core CPU service where the data is converted to pixels which are then printed onto the screen. The event loop of nodejs allows the program to continue running even when I/O operations are underway. It is achieved by stacking these asynchronous events and continuing to run the thread pool while the program waits for the input. Actually, it does not exactly wait for the input, which allows the whole asynchronous operation. When the async event is completed, a callback function is exercised and any functions related to the input is then continued. Because of not blocking the thread and not wasting CPU cycles, node js is able to handle thousands of concurrent requests to a web server, making it a very optimal solution for backend hosting.
Advantages
Frontend developers who are already familiar with javascript can write backend code in javascript aswell.
It is a more performant javascript contrary to some of the other engines.
The new ECMAScript standards can be used in nodejs since it is server side code and the client version is not a concern. The newer versions of ECMAScripts can simply be transpiled to the older versions to support legacy browsers.
Javascript, which is more than 25 years old, is a programming language that was created at Netscape as a scripting tool to manipulate web pages inside their browser. Netscape, which did not offer pleasant server-side rendering solutions was not exactly successful, part of which is due to the fact that server-side rendering was not exactly a thing back then around 2009.
However, with the release of applications like Gmail, the industry started to realize how powerful javascript can be and how user-friendly experience it can deliver. Node.js, which is around 12 years old now, was released in 2009 created by Ryan Dahl.
Node.js happened to be built in the right place and right time, specially when a shift in the web industry began. It introduces a lot of innovative thinking and approaches for JavaScript server-side development that has already helped many developers.