require-multi
A node.js utility, allowing you to require multiple modules at once using globs and reduce your boilerplate.
Description
require-multi is a simple utility for bulk requiring entire directories into a single array using glob patterns.
// routes/middleware/index.jsvar requireall = ; var { return ;}; ; app
API
requireall([path, [path, ...]], [options]);
- path - String [default =
'./*.js'
] - Specify as many relative paths as you want to require files from. Exclusions can be set by prefixing with!
. - options - Object - augment the behavior (see options section below)
Options
options.resolve - Function (module, filename)
the resolve callback is invoked for each required module. It receives the module and the relative filename. It's return value replaces module
in the set of results.