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.

From

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

Note

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