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.
- Chapter 3: Loading Modules
- Publisher: Wrox
- Released: October 2012
A local module needs a file named package.json, to be loaded by Node require.
Share this highlighthttp://www.safaribooksonline.com/a/professional-nodejs-building/259407/