How To Have A Commonjs Module Execute Its Main() (as In Python)?
I wonder if a method exists that would run a predefined function in a CommonJS module (as those used in Node.js). I wrote a couple of node modules that act as services/servers. I c
Solution 1:
if (require.main === module) {
console.log("running standalone");
}
Post a Comment for "How To Have A Commonjs Module Execute Its Main() (as In Python)?"