Nominal Pizza Masticator

    require-apply-packages

    0.5.1 • Public • Published

    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

    Install

    npm i require-apply-packages

    DownloadsWeekly Downloads

    4

    Version

    0.5.1

    License

    MIT

    Last publish

    Collaborators

    • wilmoore