Node.js is a cross-platform, single-threaded, open-source runtime environment that runs JavaScript applications outside the client's browser. It is written in C / C++ and is built on top of Google's V8 JavaScript engine to expose a set of libraries to JavaScript. The Chromium project from Google initially developed V8 to run for the Chrome browser and Chromium-based applications. At its core, V8 is a powerful virtual machine that compiles JavaScript to native machine code before its execution to achieve runtime performance.
Node.js was first presented by American software engineer Ryan Dahl in 2009 at the annual European JSConf to offer networking applications a non-blocking input / output (I / O) architecture. He wanted to work in an environment that could handle different networking tasks simultaneously without sacrificing performance.
Dahl questioned how traditional server applications used to perform I / Orelated jobs. Before Node.js, a typical server would block the program while waiting for a response after being asked to complete an I / O task (for example, querying the database). Initial web application technologies attempted to avoid this issue by spinning up threads for requests. A different thread would handle each request to minimize wait time for clients.
However, threads were not free. Each thread execution stack required context switching and additional memory. Also, they could still block while performing I / O operations. Dahl believed he could leverage the power of the V8 JavaScript engine to design a fast, single-threaded, cross-platform environment that would use an event-driven and non-blocking I / O architecture. And Node.js was born!
We'll unpack each of the descriptors of Node.js in a later section of this page. But for now, we'll note that Node.js allows developers to write applications that concurrently execute most I / O and JavaScript code operations without blocking. This non-blocking I / O model is at the core of Node.js’s strength.