I\'m writing a web app in Node. If I\'ve got some JS file db.js with a function init in it how could I call that function from the command line?
db.js
init
Try make-runnable.
In db.js, add require('make-runnable'); to the end.
require('make-runnable');
Now you can do:
node db.js init
Any further args would get passed to the init method.