June 2014
Intermediate to advanced
696 pages
38h 52m
English
Listing 27.8 implements the route handling code for the CommentThread model. Two routes are handled: getComment() and addComment(). Due to the size of the file, the code for these two routes is broken down in the following sections.
The getComment() route handler looks up a single CommentThread document, based on the _id field passed in as commentId in the GET request query string.
Listing 27.8 comments_controller.js-getComment: Implementing the route to get comment threads for the Express server
04 exports.getComment = function(req, res) {05 CommentThread.findOne({ _id: req.query.commentId })06 .exec(function(err, comment) ...
Read now
Unlock full access