How the Node Module System Works

In this tutorial, learn how the file-based Node.js module system works, and about core, local, and third-party modules. As building blocks of code structure, Node.js modules allow developers to better structure, reuse, and distribute code. A module is a self-contained file or directory of related code, which can be included in your application wherever needed. Modules and the module system are fundamental parts of how Node.js applications are written and structured.

Every JavaScript file in Node.js can be considered a module, and each file can export code which can be used by other parts of an application.

In this tutorial we'll:

  • Explore module and package architecture, and how the module system helps us write better code
  • Understand core modules, local modules, and third party modules
  • List different ways to export code from a module
  • Review how the require function or require call works
Log in or Sign up to view the complete tutorial.

Sign in with your Osio Labs account
to gain instant access to our entire library.