I recently started to understand NodeJS, and generally all turns out, but I can't figure out how to connect to the main file with your other scripts.
Let me explain with an example.
I have two script index.js and test.js and I want test.js to connect to the index.
In the code I do var test = require('./test');. It's easy, there's no question. But how to make sure that they work?
Each file is executed (successfully) code.
var test = require('./test');
var id = 2+2;
ID successfully obtained.
In the file test runs successfully is not associated with the first file identification (ID I put hands):
var id = 4;
var info1 = id+15;
var info2 = id+10;
Actually a question - how to attach the file test.js to run in index.js took id in the first file output console.log(info1); and console.log(info2); that is the result of the first file was:
Searches over the network gave some results, but the examples and explanations there is quite abstract, I alas was not able to relate with your example.