Created
April 27, 2012 01:33
-
-
Save tj/2504880 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
function tagsMiddleware(req, res, next) { | |
res.local('tags', {}); | |
if (req.session.logged_in) { | |
User.findOne({ _id: req.session.user_id }, function (err, docs) { | |
if (!err) { | |
res.local('tags', { | |
ignored: docs.ignored_tags, | |
favorite: docs.favorite_tags | |
}); | |
} | |
next(); | |
}); | |
} else { | |
next(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment