diff --git a/src/api/posts/src/routes/posts.js b/src/api/posts/src/routes/posts.js index 9fa9d332a5..b237094117 100644 --- a/src/api/posts/src/routes/posts.js +++ b/src/api/posts/src/routes/posts.js @@ -11,7 +11,7 @@ posts.get('/', validatePostsQuery(), async (req, res, next) => { const defaultNumberOfPosts = process.env.MAX_POSTS_PER_PAGE || 30; const capNumOfPosts = 100; const page = parseInt(req.query.page || 1, 10); - const expand = req.query.expand ? parseInt(req.query.expand) : 0; + const expand = req.query.expand ? parseInt(req.query.expand, 10) : 0; let ids; let perPage; let postsCount; @@ -64,7 +64,8 @@ posts.get('/', validatePostsQuery(), async (req, res, next) => { if (expand === 1) { data = await Promise.all( ids.map(async (id) => { - let post = await Post.byId(id); //obtain the corresponding feed to populate the author's name to the return data. + // obtain the corresponding feed to populate the author's name to the return data. + const post = await Post.byId(id); return { id, url: `${postsUrl}/${id}`,