See the written version of this tutorial for links to prerequisites and related tutorials: https://heynode.com/tutorial/how-node...
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
Heynode.com: The best online Node.js courses and tutorials to help you solve hard problems fast.