El Objeto module y module.exports

  1. In each module, the module free variable is a reference to the object representing the current module.

  2. In particular module.exports is the same as the exports object.

  3. module isn't actually a global but rather local to each module.

  4. The exports object is created by the Module system. Sometimes this is not acceptable, many want their module to be an instance of some class. To do this assign the desired export object to module.exports.

    La asignación a module.exports debe hacerse inmediatamente. No puede hacerse en un callback.

Casiano Rodriguez León 2015-01-07