Filter out non js files from middleware loader

This commit is contained in:
Ritchie 2013-06-17 08:23:41 -07:00
parent d358ab674c
commit dff810f31c
1 changed files with 8 additions and 3 deletions

View File

@ -63,9 +63,14 @@ for (var key in express) {
* for example `asteroid.configure` etc. * for example `asteroid.configure` etc.
*/ */
fs.readdirSync(path.join(__dirname, 'middleware')).forEach(function (m) { fs
asteroid[m.replace(/\.js$/, '')] = require('./middleware/' + m); .readdirSync(path.join(__dirname, 'middleware'))
}); .filter(function (file) {
return file.match(/\.js$/);
})
.forEach(function (m) {
asteroid[m.replace(/\.js$/, '')] = require('./middleware/' + m);
});
/** /**
* Error handler title * Error handler title