Skip to content

require module that takes care of project modules and prevents require('../../../../foo') thing

License

Notifications You must be signed in to change notification settings

aliorouji/requerem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

requerem

a "require" replacement that prevents require('../../../../foo') thing when working with multiple modules in nodejs apps.

Installation

npm install requerem --save

Usage

In top of your main js script (app.js) add:

require('requerem'); // it adds your app-root to module resolver path

now you can simply require your app-specific modules relative to your project root:

var User = require('models/User'); // app-specific module (relative to project root)

and requiring npm-installed modules stays the same as before:

var mongoose = require('mongoose'); // installed modules

also relative paths:

var config = require('./config');

Tests

npm test

About

require module that takes care of project modules and prevents require('../../../../foo') thing

Resources

License

Stars

Watchers

Forks

Packages

No packages published