require-walk
Recursively require Node.js modules and apply optional parameters
Example uage
Example 1: ExpressJS/KoaJS routes with parameters
Instead of this:
require('./routes/routes-users.js')(app);
require('./routes/routes-default.js')(app);
require('./routes/routes-auth.js')(app);
You can do:
var requireWalk = require('require-walk');
requireWalk(__dirname + '/routes')(app);
Example 2: MongooseJS models with no parameters
var requireWalk = require('require-walk');
requireWalk(__dirname + '/models')();
test/coverage
Tests with code coverage report in git clone the full repo
npm install
npm test
Linting
./node_modules/jshint/bin/jshint lib/*.js
./node_modules/jshint/bin/jshint test/*.spec.js