requireall

v1.0.0
Returns an array of results based on "require"ing all files that match the glob pattern.

requireall

Returns an array of results based on "require"ing all files that match the glob pattern.

Usage

The following example shows how you could easily modularize an express app and automatically load the modules from a directory.

var express = require('express'),
    requireall = require('requireall');

var app = express();

...

requireall('modules/*.js').forEach(function(factory) {
    factory(app);
});
npm i requireall

Metadata

  • MIT
  • Whatever
  • David Meads
  • released 3/2/2017

Downloads

Maintainers