lundi 7 mars 2016

handle too many require in nodejs

I'm writing a HTTP server with nodejs and express and I have a db module using in many other modules.

Is there a problem require this module in many many files?

Does too many requires cause memory leak?

Is it a better way like using global var?

my module is something like this :

module.exports = (function() {
    return {
        user : ...
    };
})();

Thanks for any help.

Aucun commentaire:

Enregistrer un commentaire