Skip to content

Requires each main module from packages in a base directory, invoking each exported function with optional parameter(s).

License

Notifications You must be signed in to change notification settings

wilmoore/require-apply-packages

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Requires each main module from packages in a base directory, invoking each exported function with optional parameter(s).

Resources

License

Stars

Watchers

Forks

Packages