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 in Others by code_ninja
• 6,220 points
37 views

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 by ArchanaNagur
• 2,270 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 in Others by Hemant Gajbe
76 views
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
77 views
0 votes
1 answer

How to install C#

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

answered Feb 28 in Others by Pratibha
• 2,980 points
39 views
0 votes
1 answer

Golang on Linux... How to install it?

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

answered Mar 1 in Others by Anvi
• 13,220 points
80 views
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,790 points
153 views
0 votes
1 answer
0 votes
0 answers

How to communicate gRPC example working with Node.js?

Hi Guys, I am working as a Node.js ...READ MORE

Dec 5, 2018 in Others by camillelola
• 140 points
323 views
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 in Others by ArchanaNagur
• 2,270 points
42 views
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 in Others by ArchanaNagur
• 2,270 points
21 views