I am making a library in NodeJS and it requires some configuration variables
I want to be able to define those variables in the main js file, and be able to use them in the core.js file like so
var config1 = "stuff";
var config2 = "more stuff;
var db = require('./core.js'); //this file uses config1 and config2
Is there any way to do this WITHOUT using exports.config1
and including the file in core.js?
I'm sorry if this is obvious but I couldn't find anything on google.
EDIT
I used a class with constructor
var config1 = "stuff";
var config2 = "more stuff;
var tt = require('./core.js');
const db = new tt(config1, config2);