Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jun 1st, 2012  |  syntax: JavaScript  |  size: 0.44 KB  |  views: 55  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. app.get('/:titless?', function(req, res) {
  2.     PostDB.prototype.find({title: req.body.titless}, function(error, article_collection) {
  3. console.log(article_collection);
  4. console.log(error);
  5. switch (req.params.format) {
  6.       case 'json':
  7.         res.send(documents.map(function(d) {
  8.           return { title: d.title, id: d._id };
  9.         }));
  10.       break;
  11. default:
  12.         res.send('Format not available', 400);
  13.       break;
  14. }
  15.   });
  16. });
clone this paste RAW Paste Data