Node.js Local Module
Step 1: Create a local module with the filename Welcome.js
Explanation: Here, we declared an object ‘welcome’ with a function sayHello and two variables currTime and companyName. We use the module.export to make the object available globally.
Part 2: In this part, use the above module in the app.js file.
Explanation: Here, we import our local module ‘sayHello’ in a variable ‘local’ and consume the function and variables of the created modules.
Hello GeekforGeeks user 12/6/2019 GeekforGeeks
Please Login to comment...