Skip to content

Instantly share code, notes, and snippets.

@OdongAlican
Created April 14, 2020 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OdongAlican/b47716e1d166a1c820802d8b6bfd1045 to your computer and use it in GitHub Desktop.
Save OdongAlican/b47716e1d166a1c820802d8b6bfd1045 to your computer and use it in GitHub Desktop.
Getting the articles
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