Node.js Modules

  • Node.js modules are very useful to keep the common functionalities to a separate module_name.js file to reuse it in project/app as per the requirements.
  • Node.js module has it's own context, so it can not interfere with other modules or pollute global scope.so if we create any new module that won't interfere with other modules in project/app.
  • Node.js modules follows the commonJS modules standards.
  • If you want to utilise latest ES6 features then you can setup your node project/app using babel.
Type of Node Modules

Node has mainly three type of modules

  1. Core (Builtin) Modules
  2. Custom (Local) Modules
  3. 3rd Party (External) Modules
Advantages/Benefits of Node Modules
  • Encapsulation
  • Reusability
  • Security