Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. articlesRouter
  2. .route('/')
  3. // Get returns all articles
  4. .get((req, res, next) => {
  5. ArticlesService.getAllArticles(
  6. req.app.get('db')
  7. )
  8. .then(articles => {
  9. res.json(articles.map(article => ({
  10. id: article.id,
  11. title: article.title,
  12. style: article.style,
  13. content: article.content,
  14. date_published: new Date(article.date_published)
  15. })))
  16. })
  17. .catch(next)
  18. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement