Back

Explore Courses Blog Tutorials Interview Questions

Explore Tech Questions and Answers

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

0 votes
2 views
by (9k points)
How do you reuse a module in Node.js?

1 Answer

0 votes
by (45.3k points)

In Node.js, you have the option to break down a large set of codes into smaller ones called modules. These modules help you reuse the codes. Here is how you can create and reuse a module in Node.js:

  • Create your module and export it using the keyword ‘module.export’
  • Export the entire module or part of the module as required
  • After exporting, import the necessary functionalities from the module
  • Use the keyword ‘require’ in order to import any functionality of the module

If you wish to learn in-depth about Node.js and how you can reuse the necessary modules, watch this tutorial:

Related questions

0 votes
1 answer
asked Dec 30, 2019 by anmolj (9k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...