Installation And Working Of Node.js

What is Node.JS

Node.js was developed in 2009 by Ryan Dahl as an answer. See the  answer on Google Group. Especially when dealing with web services. After some time V8 JavaScript engine for the chrome browser, which was highly optimized for web traffic, Dahl created Node.js on V8 as a server-side Environment that matches the client–side environment in the browser.

Node.js has a great ecosystem build-up. Node.js environment is extremely clean and easy to install, configure and deploy. We can write most of the server side code in Node.js including webserver and server side scripts and any other supporting web application functionality. Webserver can run directly on the node.js platform which means it’s very easy to use.

Who Uses Node.js:

Node.js has gain a lot of popularity among a wide variety of companies and in a short span. The following companies using the Node.js technology.

  1. Yahoo!
  2. LinkedIn
  3. eBay
  4. Microsoft

Uses of Node.js:

  1. Web Services API’s
  2. Real time multiplayer Games
  3. Backend web services
  4. Web applications

Installation of Node.js

We can download Node.js software from the website Node.js.

Installation of Node.js

After successful installation look into the installation location and then you can see the three important parts.

1. Node: This file starts a Node.js JavaScript engine. You can execute any JavaScript file with this node file.

Node

2. npm: npm is used for managing the Node.js Package.

npm

3. node_module: This folder contains the installation Node.js Package. This package acts as a Library.

node_module

Verifying Node.js Installation

After successful installation of Node.js, you can check it’s working.

Open Command Prompt and write the following command:

node

Next, at the Node.js prompt will appear. After the prompt is visible, write the following command:

console.log(“NeErAj KuMaR”);

Press Enter



After you will see “NeErAj KuMaR” written in the console screen.

And want to exit from command prompt press (Ctrl+d).

Next, now check npm working so write command in command prompt.

npm version

Press Enter. You should see output similar to the following.

output

Node.js IDE

If you want to use IDE for your Node.js projects, use eclipse; it has great Node.js plugin’s and also comes with some good features.

You can use another editor if you want to generate your Node.js web application.

Working with Noje.js Package

One of the most powerful feature of the Node.js framework is the ability to easily extend it with addition Node Package Module (NPM) using the Node Package Manager (NPM).

What is Node Package Module?

A Node Package Module is a Packaged library that can be easily shared, reused and installed in different projects.

Each Node Packaged Module includes a package.json file that defines the package property. The package.json file includes information metadata such as:

  1. Name
  2. Version
  3. Author
  4. Contributors
  5. Description


Similar Articles