Created
March 16, 2020 13:14
-
-
Save kluu1/e32a6aaeba08c3a877d28ef66def4ca9 to your computer and use it in GitHub Desktop.
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
| 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