Skip to content

Instantly share code, notes, and snippets.

@thejefflarson
Created September 1, 2010 07:27
Show Gist options
  • Save thejefflarson/560362 to your computer and use it in GitHub Desktop.
Save thejefflarson/560362 to your computer and use it in GitHub Desktop.
fs.readdirSync(__dirname + '/middleware').forEach(function(filename){
if (/\.js$/.test(filename)) {
var name = filename.substr(0, filename.lastIndexOf('.'));
Object.defineProperty(exports.middleware, name, { get: function(){
return require('./middleware/' + name);
}});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment