Created
March 26, 2014 12:23
-
-
Save adaptivedev/9781956 to your computer and use it in GitHub Desktop.
how can I call findAll in games.js from turnys.js (how do I define an object-function that defines "send"
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
creating 1 turny per 1 game | |
/Users/rover/.nvm/v0.10.26/lib/node_modules/mongodb/lib/mongodb/connection/base.js:242 | |
throw message; | |
^ | |
TypeError: Object function (){ | |
send = function(msg) { | |
console.log("populateDb: gamesAll: res: send: msg="+msg); | |
}; | |
} has no method 'send' |
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
exports.findAll = function(req, res) { | |
gamedb.collection('games', function(err, collection) { | |
collection.find().toArray(function(err, items) { | |
res.send(items); | |
}); | |
}); | |
}; |
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
var gamesAll = games.findAll(null, send = function(){ | |
send = function(msg) { | |
console.log("populateDb: gamesAll: res: send: msg="+msg); | |
}; | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment