Created
April 8, 2013 16:07
-
-
Save davetapley/5338014 to your computer and use it in GitHub Desktop.
This file contains hidden or 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.routes = function() { | |
| this.get('/', function() { | |
| var users = db.collection('users'); | |
| this.res.setHeader("Content-Type", 'text/html'); | |
| this.res.writeHead(200, {}); | |
| var that = this; | |
| var stream = users.find().forEach(function(err, userDoc) { | |
| if(userDoc) { | |
| that.res.write('<h1>' + userDoc._id + '</h1>'); | |
| that.res.write(JSON.stringify(userDoc)); | |
| if(userDoc.subscriptions) { | |
| that.res.write('<ul>'); | |
| userDoc.subscriptions.forEach(function(err, userSubscription) { | |
| if(userSubscription) { | |
| that.res.write('<li>' + userSubscription + '</h1>'); | |
| } else { | |
| that.res.write('<ul>'); | |
| } | |
| }); | |
| } | |
| } else { | |
| that.res.end(); | |
| return; | |
| } | |
| }); | |
| }); | |
| } | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We're good down to line 12, but the
ifon line 14 is never true.The goal is that if a
userhassubscriptions, their keys (e.g.facebook) should be printed in aul.