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
simple way:
let's say you have db.js file in a helpers directory in project structure.
now go inside helpers directory and go to node console
helpers $ node
2) require db.js file
> var db = require("./db")
3) call your function (in your case its init())
> db.init()
hope this helps