// Use require.main.require to get a module from the root folder.
const Globals = require.main.require("./globals.js");
const YourCustomModule = require("./yourmodule.js");
console.log(YourCustomModule.message);
// --- yourmodule.js ---
module.exports = {
message: "Hello World!",
otherData: "Hello Grepper!"
};
//What happend when we require a module.
resolving and loading,wrapping,execution,returning exports and final caching.
3 types of module we can import.(core,developer and 3rd party module)
const http= require('http') //core module
const controller = require('./lib/controller') //developer module
const express = require('express') // 3rd party module