What is Node.JS

W

Node.JS is a JavaScript-based platform built on the Google Chrome V8 JavaScript engine for the development of fast and scalable web applications. Node.JS uses an event-based model in which inbound/outbound operations are managed asynchronously so that it can be used for real-time applications that use multiple inbound/outbound operations and run on distributed devices without their performance either affected.
It is an open-source, free, widely used product to develop server-side applications or network components. Node.JS applications are written in JavaScript and can be run on multiple platforms (Linux, Windows, OS X). Several bookstores are also available to extend the functionality of Node.JS. Node Package Manager (npm), the Node.JS management system, is considered to be the largest open-source library ecosystem in the world at present. Ryan Dahl developed Node.JS in 2009.

Some of the Node.JS features are:
1. All APIs in Node.JS libraries are asynchronous (non-blocking) and event-based. They do not have to expect a particular operation to provide a result; after a particular method has been invoked, it goes on, with a notification mechanism indicating when the operation has been completed and can provide data by calling a callback method in which the information obtained is processed further.
2. Based on the Google Chrome V8 JavaScript engine, the source code execution is very fast.
3. Although they only use one thread, the applications developed using Node.JS are scalable and can handle a much larger number of competing applications than traditional HTTP servers thanks to the mechanism of event notification; so the response time is low and the availability of the large server, since data waiting is eliminated.
4. Does not use memory buffers, but provides the data gradually.
Therefore, Node.JS platform is a Web application solution that uses intensive, real-time incoming/outgoing (streaming) web-based applications for Web applications using JSON-based APIs or web applications whose content is included in a single Internet page. It is not recommended that Node.JS be used for web applications that perform numerous processing tasks as it can affect performance.

Installing Ubuntu:
For Linux, NodeJS can be installed either from the distribution repositories (using apt-get or yum) or by compiling the source on the NodeJS page. We recommend installing by compiling because versions of repositories are old.
For compilation, download the sources on the NodeJS page. You need GCC, g ++, make, OpenSSL, python installed.

The compilation is done using the following commands:
./configure
make
sudo make install

As you can see, one of the commands needs a privileged user. If you do not have this, you can install NodeJS in your local account:
./configure –prefix = ~ / local
make
make install

This will have a local directory in the user directory where NodeJS will be installed. To work, you need to add a search path to the executable files of NodeJS. For this, add the following line to the ~ / .bashrc file:
export PATH = $ HOME / local / bin: $ PATH

Installing packages:
NodeJS is just the compiler and a few libraries for programming. To add functionality, you need to install additional libraries. This is done using the npm command. The syntax is the following:
npm [-g] install library_name

Installing libraries is done in a directory called node_modules. This is either the global directory of NodeJS (if the -g parameter is specified) or in the current directory.

NodeJS is just the compiler, so you need another program to write programs.

You need a terminal to run the software. NodeJS is similar to Python in this sense. A program starts by using the command:

node file_program.js

Recent Posts

Archives

Categories