Skip to content

Instantly share code, notes, and snippets.

@dustinc
Created August 7, 2012 19:17
Show Gist options
  • Save dustinc/3288563 to your computer and use it in GitHub Desktop.
Save dustinc/3288563 to your computer and use it in GitHub Desktop.
//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