Modules & global in Node.js
In Node.js, modules are reusable pieces of code that can be exported from one program and imported into another program. Globals are variables that are available throughout the entire application. It is generally not recommended to use globals in your code as it can lead to naming conflicts and othe... read more ⬇️
What are Modules & global in Node.js | How to create Custom Module in Node.js
Concepts
1

Codebase for this lesson: https://github.com/opendevs-org/nodejs-course-youtube/tree/main/5-modules
In this video, you will learn about modules and global objects in Node.js. Modules are reusable pieces of code that can be imported and exported using the require
and module.exports
functions. You will also learn how to create your own custom modules by defining functions and objects that can be accessed by other applications. Global objects are available in all modules without any imports. Some examples of global objects are __dirname
, __filename
, console
, process
, and Buffer. Watch this video to master the basics of modules and global objects in Node.js!