Created
November 16, 2011 17:30
-
-
Save bmarini/1370744 to your computer and use it in GitHub Desktop.
async callbacks in a loop
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
app.get '/riders', (req, res) -> | |
redis.smembers 'riders', (err, replies) -> | |
results = [] | |
build_json = (rider) -> | |
redis.hgetall rider, (err, reply) -> | |
results.push reply | |
res.json(results, 200) if results.length == replies.length | |
build_json rider for rider in replies |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment