Created
August 7, 2012 19:17
-
-
Save dustinc/3288563 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//controller | |
controller.index = function(req, res, next) { | |
var users = db.users.getUsers(); | |
res.render('user/index', {users: users}); | |
}; | |
//model | |
User.statics.getUsers = function(callback) { | |
//somehow return here... this approach is not asynchronous | |
return this.find({}, function(err, docs) { | |
if(!err) { | |
return docs; | |
} | |
return err; | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment