Skip to content
An easy way to require all files within a directory.
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
Readme.md
index.js
package.json

Readme.md

require-all

An easy way to require all files within a directory.

Usage

var controllers = require('require-all')({
  directory: __dirname + '/controllers',
  filter: /(.+Controller)\.js$/,
});

// controllers now is an object with references to all modules matching the filter
// for example:
// { HomeController: function HomeController() {...}, ...}
Something went wrong with that request. Please try again.