This framework is best tool to code web applications where you require user to input data like online video streaming portals, web forms based applications, and other data intensive applications.
Node.js is open source and can be downloaded from here
NPM or Node Package Manager consists of a repository for Node.js along with CLI (command line interface).
The following are the basic commands used in NPM to be used when getting started with node.js.
node -v : command used on mac to check whether node.js has been previously installed on the system
npm -version can be used to check the version of the node.js framework installed.
npm install <name_of_module> can be used to install several packages available in NPM.
var pkg-name = require(name_of_module)
There are several packages/modules in NPM which can be installed to use the required functions in a js script.
Example- installing node.js package
‘express’ is one such module and is a web framework commonly used for its robustness and minimalist coding. It can be installed by using the following command on the command line:
npm install express
var pkg1 = require(‘express’)
A test suite can be executed after installing all the modules using the following command:
NPM command is used for initiating the node.js environment. Node.js apps can be executed on a localhost server.
A prerequisite of package.json file is also required to develop a web project.
npm i: this command is used to install all the modules from directories inside the NPM.
The Node.js server also makes your web app available to serve HTTP requests. It provides the interaction between users and your application. Creating and starting a server is an easy task using the inbuilt http module.