Created
April 14, 2020 20:39
-
-
Save OdongAlican/b47716e1d166a1c820802d8b6bfd1045 to your computer and use it in GitHub Desktop.
Getting the articles
This file contains 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
exports.get = async function (req, res) { | |
await PostModel.find({}) | |
.populate('author') | |
.exec() | |
.then((posts) => { | |
res.json(posts); | |
}, (err) => { | |
res.send(err); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment