Over a million developers have joined DZone.

Install and Run a Node.js Application

A very basic first step into the world of Node.js, using the command prompt and writing your first bit of Node code.

· Web Dev Zone

Start coding today to experience the powerful engine that drives data application’s development, brought to you in partnership with Qlik.

Let’s cover some basics first.

What is Node.js?

It is a Server-side, JavaScript platform built on Google Chrome’s JavaScript V8 engine. It is an open source and a cross platform application to develop server side and networking applications. Anyone can develop the Node.js application by writing a code in JavaScript and it can run on Microsoft Windows, Linux, or OS X.


  • Fast in code execution.
  • Highly scalable
  • Event driven and asynchronous
  • No buffering

Downloading and Installing Node.js

Visit the website and download Nodejs.exe.

Image title

Download the V6.2.2 version.

Image title

Install it by following the instructions, shown below:

Image title

Image title

Image title

Image title

Image title

Image title

After the installation is complete, search node in Windows search option and open it

Image title

Image title

Search for the current NodeJS version and npm version (just some information for your own sake) by using the commands, given below:

Image title

Now, in this command Window, type “node." The directory path will be removed and the cmd will start accepting node code, shown below: 

Image title

You can now go ahead, do some calculations, and try and print the messages on the console, as shown below:

Image title

This shows that the node is successfully installed in your system and is working as expected. Please press Ctrl+C twice to exit from the node and have a directory path again.

We will now create a small piece of code in a js file and will try to run it using NodeJS. Let’s see how it’s done. 

Create a js file, say “testingnode.js” file and write the code, given below:.

// include the http module    
var http = require('http');    
// creating a webserver with a callback function    
http.createServer(function (req, res) {    
    // respond to any incoming http request    
    res.writeHead(200, {'Content-Type': 'text/plain'});    
    res.end('Hello Everyone. From Vipul Malhotra');    
//8090 is the port number on which we are running this application. You can choose any other available port number    
// Just a log to show on the node cmd.    
console.log('Server running port 8090');   

Now, using cmd, go to the directory where this file is saved and run the command “node testingnode.js”.

Image title

Cmd will print the console msg that we have written in the file, shown above. Server is running at a port 8090.

Now, migrate to the URL http://localhost:8090/ to view the o/p 'Hello Everyone. From Vipul Malhotra' that we have written in the js file.

Image title

Please note that 8090 here is the port number that we have provided in our js file, shown above. You can provide any available port number to your application, but you would have to call the application using the port number.

Related Refcard:

Create data driven applications in Qlik’s free and easy to use coding environment, brought to you in partnership with Qlik.

node js,node js tutorial,javascript

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}