Skip to content

Commit

Permalink
fix limit aricles
Browse files Browse the repository at this point in the history
  • Loading branch information
maryan-mandzyuk committed Jul 28, 2019
1 parent 564024f commit 988798c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/api/controllers/article.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const model = require('../../db/models/article.model');
module.exports = {
// -------------GET-------------
getArticles: (req, res) => {
model.readArticles(req, req.query.limit, articles => res.json(articles));
model.readArticles(req, articles => res.json(articles));
},

getArticleById: (req, res) => {
Expand Down
4 changes: 2 additions & 2 deletions src/db/models/article.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ module.exports = {
},

// -------------READ-------------
readArticles: (req, limit, callback) => {
readArticles: (req, callback) => {
let {
query
} = req;
Expand All @@ -81,7 +81,7 @@ module.exports = {
}
ArticleModel.find(query).sort({
createDate: -1
}).limit(parseInt(limit, 10)).exec((err, data) => {
}).limit(25).exec((err, data) => {
if (!err) {
callback(data);
} else {
Expand Down

0 comments on commit 988798c

Please sign in to comment.