In Node.js, considering a main.js file:
const TOOLS = require('myTools.js');
const LIB1 = require('lib1.js');
const LIB2 = require('lib2.js');
I'll use TOOLS
functions from the main module (main.js), from LIB1
and from LIB2
.
TOOLS
will stablish connections to the database and I'm not sure if it is a good idea doing const TOOLS = require('myTools.js');
multiple times on different modules.
How do I "share" TOOLS
so it is visible from everywhere?