Introduction to NodeJs

Node.js is open-source, cross-platform, and since its introduction in 2009, it got hugely popular and now plays a significant role in the web development scene.

It provides an event-driven, non-blocking (asynchronous) I/O and cross-platform runtime environment for building highly scalable server-side applications using JavaScript.

Both your browser JavaScript and Node.js run on Google chrome's V8 JavaScript runtime engine.

This engine takes your JavaScript code and converts it into a faster machine code. Machine code is a low-level code that the computer can run without needing to first interpret it.

Nodejs is majorly used for developing server-side web applications. It is not javascript frameworks, many of the Nodejs's basics modules are written in javascript.

  • Node.js is an open-source framework under the MIT license.
  • Uses JavaScript to build the entire server-side application.
  • Node.js is built on Google Chrome's V8 JavaScript Engine, so its library is very fast in code execution
  • Node.js follows a single-threaded model with event looping
  • Asynchronous by default. So it performs faster than other frameworks.
  • The cross-platform framework that runs on Windows, MAC or Linux, and many more
  • javascript is used on the client-side but Nodejs makes the javascript to be used on the server-side as well., we can achieve the same language on the server-side and client-side.
  • Nodejs is event-based rather than multi-threaded, Only on the thread is present
  • NodeJS can handle a lot of concurrent requests

Install NodeJs

Follow the below steps to install node js, Some of the below steps requires Admin access

windows-installer-nodejs

    • Run the downloaded Node.js .msi Installer - including accepting the license, selecting the destination, and authenticating for the install.

installation-of-nodejs

    • To ensure Node.js has been installed, run node -v in your cmd - you should get something like v6.9.5

nodejs-version

  • Update your version of npm with npm install npm --global if necessary
  • You've now got Node.js installed in your system
Node.js can also be installed via a package manager. The package manager for windows is known as Chocolatey.

Hello World in Node js

Let's follow the basics program of programming and start by creating a program that will print hello mars on the console as output.

This code-snippet is as simple as it can be, Place the below code in a file called hello-mars.js.

//file-name : hello-mars.js
console.log('hello world');

You can run the above file using the following command on Command prompt/Terminal:

node hello-mars.js

The output of the above command:
hello-world-nodejs

About Author :

I am Pavankumar, Having 8.5 years of experience currently working in Video/Live Analytics project.

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions