node.js - what's the best way to reference parent/containing nodejs module? -
mymodule |__index.js |__foo.js |__bar.js
inside of foo.js want reference mymodule (parent). what's best way of doing that?
i debating between 1 of following:
var parent = module.parent.exports var parent = require('./');
you can use __dirname reference parent module.
Comments
Post a Comment