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
- HTML | DOM Local Storage clear() Method
- HTML | <input type="datetime-local">
- Local File Inclusion (LFI)
- How to Get Local IP Address of System using PHP ?
- How to Host a Local Server globally for more than one system ?
- Golang Program that uses func as Local Variable
- Getting the current date and time with timestamp in local and other timezones in Golang
- How to add records in your own local/custom database in Node.js ?
- How to add unique Id to each record in your local/custom database in Node.js ?
- How to find record by Id from local/custom database in Node.js ?
- How to find record using any key-value pair information of record in your local/custom database using Node.js ?
- How to update a record in your local/custom database in Node.js?
- How to delete a record from your local/custom database in Node.js ?
- How to store password securely in your local/custom database in Node.js ?
- Nodejs - Connect MongoDB with Node app using MongooseJS
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.