Last active
March 16, 2020 13:07
-
-
Save kluu1/3c4a2d22a49d6dcbd2a3099d3e0b08d4 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 = { | |
| 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