node-selfrequire() relative to the path inside your module.
npm install --save inside
var User = require('inside')('lib/models/user');
How does it work?The first time node-self is called, it detects which file is calling it. It then traverses up the directory tree to find the first
package.json. Then all calls to
node-selfwill simply call
require()relative to that directory.