What is Nodejs?
Node is a C++ program or run-time environment that allows JavaScript code to run outside of a browser using Chrome’s V8 JavaScript engine. It is not a framework like Asp.net or Java and hence should be compared with them.
Node is asynchronous or non-blocking by nature. A single thread is used to handle all requests. It is ideal for I/O intensive apps. The thread doesn’t wait e.g. for the database query to complete before moving on to another request.
Node should not be used for CPU intensive apps like video encoding or image manipulation and the likes.

Setup Nodejs on mac?
- Go to the Download page for Nodejs.
- Download the LTS version .pkg Mac installer file.
- Open the .pkg file and follow the Installer steps and that’s it.
- Open terminal on Mac and run command “node -v” which displays the installed version on your machine. This will confirm whether the node runtime was properly installed.
You may need to update the npm CLI client as fixed version is installed with the LTS version, npm is the package manager for Javascript. Run the following command at the Terminal:
$ sudo npm install npm --global
Start exploring and build your first app. At the terminal, run the following commands:
$ cd Documents
$ mkdir node-course
$ cd node-course
$ mkdir first-app
$ cd first-app
$ touch app.js
The above commands brings us inside the new created folder first-app and created our JavaScript file app.js. Now open this file in your preferred editor like Sublime, atom, Visual Studio Code or Visual Studio for Mac. I’m using the Visual Studio for Mac Community edition. In the editor, add the below code to app.js:
function sayHello(name){
console.log('Hello ' + name);
}
sayHello('Pulkit');
Back to Terminal, run the app:
$ node app.js
You should see the following output:
Hello Pulkit
Hence, you successfully run your first app using node on Mac.