Created
April 8, 2012 22:31
-
-
Save distracteddev/2340126 to your computer and use it in GitHub Desktop.
Resourceful Question (GET)
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.getBP = function(id) { | |
var self = this; | |
if (arguments.length < 2) { | |
BlogPost.all(function(err, docs) { | |
if (err) throw err; | |
self.res.end(JSON.stringify(docs) + '\n'); | |
winston.debug(docs); | |
return docs; | |
}); | |
} | |
else { | |
console.log('ID: ' + id); | |
BlogPost.get(id, function(err, post) { | |
if (err) throw err; | |
self.res.end(JSON.stringify(post) + '\n'); | |
winston.debug(post); | |
return post; | |
}); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment