express-load
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -1,8 +0,6 @@ | ||
exports.index = function(req, res, next) { | ||
var User = req.app.models.user; | ||
User.findById(0, function(user) { | ||
res.send('Here is a user: ' + user.name + ' - ' + user.email); | ||
res.send('Have a user: ' + user.name + ' - ' + user.email); | ||
}); | ||
}; |
@@ -1,2 +0,2 @@ | ||
exports.isAuthenticated = function(req, res, next) { | ||
exports.isAuthenticated = function() { | ||
if (true) { | ||
@@ -3,0 +3,0 @@ next(); |
module.exports = function(app) { | ||
console.log(app.models); | ||
// Dummy db. | ||
@@ -6,0 +4,0 @@ var users = [ |
@@ -32,3 +32,5 @@ /*! | ||
var ExpressLoad = function(entity, options) { | ||
this.options = options || {}; | ||
this.options = options || {} | ||
if(this.options.checkext === undefined) { this.options.checkext=true;} | ||
if(this.options.extlist === undefined) { this.options.extlist=['.js','.node']; } | ||
this.scripts = []; | ||
@@ -78,2 +80,8 @@ this.then(entity); | ||
if(this.options.checkext && (this.options.extlist.indexOf(path.extname(dir[file]))==-1)) { | ||
this.__log('Ignoring file: extension not allowed ' + dir[file], 'warn'); | ||
allow = false; | ||
} | ||
if (allow) { | ||
@@ -80,0 +88,0 @@ var name = getName(script); |
{ | ||
"name": "express-load", | ||
"description": "Autoload modules into an Express application instance, config, models, routes, controllers etc...", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"author": { | ||
@@ -11,4 +11,5 @@ "name": "Jarrad Seers", | ||
{"name": "Jarrad Seers", "email": "jarrad@jarradseers.com"}, | ||
{"name": "Alex Koller", "email": "alex@webmolecule.co.za"}, | ||
{"name": "Fabien Franzen", "email": "info@atelierfabien.be"} | ||
{"name": "Alex Koller", "email": "alex@webmolecule.co.za"}, | ||
{"name": "Fabien Franzen", "email": "info@atelierfabien.be"}, | ||
{"name": "Jean-Matthieu Barbier", "email": "jm.barbier+github@solidev.net"} | ||
], | ||
@@ -15,0 +16,0 @@ "main": "index", |
@@ -105,2 +105,8 @@ | ||
_express-load_ will by default only load files ending with .js or .node extensions, unless you set checkext option to false : no file extension check at all. You can also change the list of allowed extension (in extlist option). | ||
```js | ||
load('controllers', {checkext:true, extlist:['.js','.myextension']}).into(app); | ||
``` | ||
### Nested Folders | ||
@@ -107,0 +113,0 @@ |
Sorry, the diff of this file is not supported yet
18838
457
190