Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- articlesRouter
- .route('/')
- // Get returns all articles
- .get((req, res, next) => {
- ArticlesService.getAllArticles(
- req.app.get('db')
- )
- .then(articles => {
- res.json(articles.map(article => ({
- id: article.id,
- title: article.title,
- style: article.style,
- content: article.content,
- date_published: new Date(article.date_published)
- })))
- })
- .catch(next)
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement