text: const db = require("../models");
  
  module.exports = {
    findAll: function(req, res) {
      db.Article
        .find(req.query)
        .sort({ date: -1 })
        .then(function(dbArticle) {
          res.json(dbArticle);
        });
    },
    // Delete the specified headline
    delete: function(req, res) {
      db.Article.remove({ _id: req.params.id }).then(function(dbArticle) {
        res.json(dbArticle);
      });
    },
    // Update the specified headline
    update: function(req, res) {
      db.Article.findOneAndUpdate({ _id: req.params.id }, { $set: req.body }, { new: true }).then(function(dbArticle) {
        res.json(dbArticle);
      });
    }
  };
  