I have a folder in my express.js app containing three files:
// models/one.js
exports.One = function() { return 'one'; }
// models/two.js
exports.Two = function() { return 'two'; }
// models/three.js
exports.Three = function() { return 'three'; }
I'd like to be able to use it like this:
var db = require('./models');
doSomething(db.One, db.Two, db.Three);
In other words, I want to group exports from multiple files in one variable.
I know that by default that require statement will look for models/index.js. Is there anything I could put in index.js that will allow it to inherit the exports from the other files in the directory, such as (non-working psuedocode):
// models/index.js
exports = require('./one.js', './two.js', './three.js);
Thoughts? Thanks!