0.5.1 • Published 9 years ago

require-apply-packages v0.5.1

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

require-apply-packages

Build Status NPM version NPM downloads js-standard-style Commitizen friendly semantic-release

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'
  })
}

Alternatives

License

LICENSE

0.5.1

9 years ago

0.5.0

9 years ago

0.4.1

9 years ago

0.4.0

9 years ago

0.3.0

10 years ago