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
- Nodejs | authentication using Passportjs and passport-local-mongoose
- Nodejs | Automatic restart NodeJs server with nodemon
- Nodejs | DNS
- Nodejs | DNS | setServers()
- Web-Socket in NodeJS
- Nodejs | Jimp
- Encrypting Data in NodeJS
- Difference between NodeJS and AngularJS
- Dockerizing a simple Nodejs app
- Nodejs | Web Crawling using Cheerio
- Nodejs | GM charcoal() Function
- Nodejs | GM blur() Function
- Nodejs | GM sharpen() Function
- Signup Form Using Nodejs and MongoDB
- Nodejs – Connect Mysql with Node app
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.