Skip to content

Instantly share code, notes, and snippets.

@kluu1
Created March 16, 2020 13:14
Show Gist options
  • Select an option

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

Select an option

Save kluu1/e32a6aaeba08c3a877d28ef66def4ca9 to your computer and use it in GitHub Desktop.
const db = require("../models");
module.exports = {
findAll: async function(req, res) {
const { id } = req.query;
try {
const books = await db.Book.find(id).sort({ date: -1 });
res.json(books);
} catch (err) {
res.json(err);
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment