Node.js Local Module
Step 1: Creating a local module with filename
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 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...