How to include/ install any library in node.js application program?

0 votes
Being early stage learner of Node.js I want to know how to include/install libraries in Node.js using Both ES5 and ES6.
Jul 26, 2019 in Others by code_ninja
• 6,230 points

1 answer to this question.

0 votes

Node.js is server side runtime environment that lets us use JavaScript for development of backend applications

  • Module is the only way to install any library in Node.js application
  • Basically module in Node.js is a functionality which is organised in a single or multiple JavaScript file and can be reused throughout the Node.js application
  • There are 3 categories of modules:
  1. Core modules: They are in-built and you can use them without any installation
  2. User defined modules: They are created by you and you can reuse them in rest of your application
  3. Node Package Manager: These include a group of Modules or packages, developed by other developers, which can be used in your application by installing them
  • We usually include/install a library(module) using following syntax:
  1.  ES5: var module = require('module_name')
  2.  ES6: import {module} from ‘module_name’
  • The require() function mentioned here returns an object, function, property or any other JavaScript type, depending on what is mentioned in module

I hope this clears your doubt:)

answered Jul 26, 2019 by ArchanaNagur
• 2,320 points

Related Questions In Others

0 votes
0 answers

How to handle large http response data from observer in Angular application to avoid browser crash?

Suppose we have a angular application which ...READ MORE

Apr 18, 2019 in Others by Hemant Gajbe
0 votes
1 answer

How to get the URL of the current tab in Google Chrome?

There are different ways of doing this:- You ...READ MORE

answered Dec 21, 2018 in Others by Nabarupa
0 votes
1 answer

How to install C#

Hi @Akanksha, C# is a programming language ...READ MORE

answered Feb 28, 2019 in Others by Pratibha
• 3,690 points
0 votes
1 answer

Golang on Linux... How to install it?

Hey @Abhi, if you want to install ...READ MORE

answered Mar 1, 2019 in Others by Anvi
• 14,030 points
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,810 points
0 votes
1 answer
0 votes
1 answer

How to communicate gRPC example working with Node.js?

hi.. you can read below link, it ...READ MORE

answered Dec 2, 2019 in Others by Narendra Reddy Dalli
0 votes
1 answer

How do I start studying Node.JS to create a restful API?

Node.js is an open source server environment ...READ MORE

answered Jun 10, 2019 in Others by ArchanaNagur
• 2,320 points
0 votes
1 answer

In order to learn Node.js, I should be familiar with which other technologies ?

I appreciate your decision, its the perfect ...READ MORE

answered Jul 31, 2019 in Others by ArchanaNagur
• 2,320 points