O'Reilly logo
  • Bach Ly thinks this is interesting:

You can use the path for a folder to load a module like this:

var myModule = require('./myModuleDir');

If you do so, Node will search inside that folder. Node will presume this folder is a package and will try to look for a package definition. That package definition should be a file named package.json.


Cover of Professional Node.js: Building Javascript Based Scalable Software


A local module needs a file named package.json, to be loaded by Node require.