From ce2ee2369ff0c4aedc1a13d04359d918ea1b3d8d Mon Sep 17 00:00:00 2001 From: Tyler Henkel Date: Sat, 1 Feb 2014 21:57:09 -0500 Subject: [PATCH] fix(server): only require models if they are coffescript or js files closes #75 --- templates/express/server.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/express/server.js b/templates/express/server.js index 1ab2f8241..760a55682 100644 --- a/templates/express/server.js +++ b/templates/express/server.js @@ -21,7 +21,9 @@ var db = mongoose.connect(config.mongo.uri, config.mongo.options); // Bootstrap models var modelsPath = path.join(__dirname, 'lib/models'); fs.readdirSync(modelsPath).forEach(function (file) { - require(modelsPath + '/' + file); + if (/(.*)\.(js$|coffee$)/.test(file)) { + require(modelsPath + '/' + file); + } }); // Populate empty DB with sample data