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,300 points
• 3,041 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:)

To know more about Node JS, It's recommended to join Node JS Course today.

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

Related Questions In Others

0 votes
0 answers

How to get response from S3 getObject in Node.js?

I am attempting to get data back ...READ MORE

Apr 23, 2022 in Others by Kichu
• 19,040 points
• 3,006 views
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 19, 2019 in Others by Hemant Gajbe
• 3,854 views
0 votes
1 answer

How to install Flutter in Windows system?

Hi@akhtar, You can follow the below-given steps to ...READ MORE

answered Jul 17, 2020 in Others by MD
• 95,460 points
• 3,898 views
0 votes
1 answer

How to install Dart in Windows system?

Hi@akhtar, Dart is the programming language used to code Flutter apps. ...READ MORE

answered Jul 21, 2020 in Others by MD
• 95,460 points
• 2,919 views