Getting Start With Node.js (Installation and Hello World App)

Nowdays "node.js" is a new technology that has been getting a lot of attraction for many software developers.

Node.js is the new programming environment that you need to make the application real-time and more scalable. Node.js fully implements Asynchronous Programming. Every function in Node.js is asynchronous. Therefore it is lightning fast JavaScript execution.

According to nodejs.org "Node.js allows us to build our real-time cloud IDE with a single language front to back. It makes life easier for both us and our users to write, run, and debug code, anywhere, anytime."

So, let's start with how to install the node.js environment in our Windows OS.

You and download the latest version of node.js from the official siite:

http://nodejs.org/

After downloading, run the .exe file and follow the steps of the installation wizard. You can easily install it on your machine.

Here are some screenshots of the installation wizard:

image2.gif


image3.gif

After installing the package, to ensure that node.js was installed in your machine, from the Start menu go to "All Programs" and search for the node.js folder.

After you find that, open the node.js command prompt from there.

Clipboard05.jpg

To see the current version of node.js installed, type the node -v on the node.js command prompt.

Clipboard04.jpg

This will print the current version of node js installed in your machine.

Now, let's start to create a simple Hello World application using node.js.

First, open the Notepad editor and write the following code.

Clipboard06.jpg

Then save file as "HelloWorld.js."

Now, to execute this js file open the node.js command prompt. 

Type:

node HelloWorld.js

This will print the text you write in the text file on the console.

Result:

Clipboard07.jpg

X

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now