Skip to content

Instantly share code, notes, and snippets.

@kluu1
Last active March 16, 2020 13:07
Show Gist options
  • Select an option

  • Save kluu1/3c4a2d22a49d6dcbd2a3099d3e0b08d4 to your computer and use it in GitHub Desktop.

Select an option

Save kluu1/3c4a2d22a49d6dcbd2a3099d3e0b08d4 to your computer and use it in GitHub Desktop.
const db = require('../models');
module.exports = {
findById: function(req, res) {
const { id } = req.query;
db.Book.find(id)
.sort({ date: -1 })
.then(data => res.json(data))
.catch(err => res.json(err));
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment