Node.js is a JavaScript runtime that is built on Chrome's V8 JavaScript engine. Node.js uses an single-thread, event-driven, non-blocking I/O model making it lightweight and efficient.

Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries that makes development on nodejs quick and easy.

NodeJS uses JavaScript and even simple commands can be run from command line. For example, the following code when saved as a file can be run from command line.

        console.log('My first NodeJS code');

When the above code is saved as a file - index.js - the file can be executed from the command line (windows) as shown below.

        > rem note: navigate to the 'index.js' folder in command line
        > node index.js
        > rem can also be run in the following way
        > node index

It is interesting that NodeJS is fast even though it is single threaded. Below are the characteristics of NodeJS.

Single Threaded

NodeJS is single threaded and never spawns on other threads. This makes it easy for developers to build application using NodeJS as they do not need to deal with concurrency. Even after running on a single thread, NodeJS runs fast and is highly scalable due to its non blocking IO model.

Event Driven

NodeJS is event driven meaning that it responds when something happens by running the necessary code and on other times it simply waits leaving the CPU free.

Non-Blocking I/O

In NodeJS, the execution does not stop for I/O requests and this is the main reason for its scalability. This means that when a file is read and database query is run, the execution does not stop and keeps processing the following code. The I/O calls register a callback which is executed when the actual I/O requests complete.

Articles involving NodeJS