I have some questions about module exporting and their inheritance in node.
I know you can export a module with
module.exports = function User(){
// Lot of code
}
But, how could you add prototypes functions and get them exported as well? Is this automatic?
For example will this code be available to the exported user?
User.prototype.login = function (password) {
// Much more code
}
And finally, if I require moduleA and moduleB in the main script, will be able moduleB to use those objects or should I require it as well? What route should be used?