Nodejs Check Module Executed or Required
In Python, if you want to check if your module is being executed directly or being included you would do so like this:
if __name__ == '__main__':
main()
I'm sure you have seen that in many Python scripts.
To accomplish the same thing in Node:
module.exports.init = function(){
//...
};
if(require.main === module){
module.exports.init();
}