I figured out how to include a JS file in Node JS. But I have a JS file(hashing.js) which uses a function from other JS file(encoding.js).
In encoding.js, I have
exports = exports || {};
exports.encoding = encoding function
In hashing.js, I have
exports = exports || {};
exports.hashing = hashing function
The hashing function uses encoding inside it.
I am including them in Node JS like
var encoding = require (./encoding.js);
var hashing = require (./hashing.js);
But when I am including the JS files like this, running the hashing var throws an error
encoding is not defined
So I am unable to include JS files in Node JS which depend on some other JS files.