When building an application, as our application/code becomes complex we cannot put our entire code in one single file.As this becomes unmanageable, we use node modular pattern to write different files and export them(which includes functions, objects, and methods) to the main files.Now you might ask what exactly is a module
?In simple terms, a module
is nothing but a JavaScript file. That’s It.With the node modular functionality, we can import your own external files, core node modules, and npm modules.
In this article, we are going to discuss, how we can export and import our own files.
Basically, there are two files calculate.js
from where we will export and import them into the main.js
file.
#nodejs #web-development #javascript #software-development