require-apply-packages
v0.5.1
Published
Requires each main module from packages in a base directory, invoking each exported function with optional parameter(s).
Downloads
3
Maintainers
Readme
require-apply-packages
Requires each main module from packages in a base directory, invoking each exported function with optional parameter(s).
$ npm install require-apply-packages --save
Examples
loading a directory and all subdirectories of Koa route modules.
NOTE: loading Koa routes was my initial use-case; however, this module is not tied to koa in any way.
var load = require('require-apply-packages')
var path = require('path')
var skip = []
load(path.resolve(__dirname, "app", "resources"), app, skip)
defining a Koa ping
resource module.
module.exports = function (app) {
app.get('/ping', function *(next) {
this.body = 'pong'
})
}