can sort posts chronologically in userline and formatted topics listing for each post

This commit is contained in:
Aditya Sankaran
2019-12-05 18:50:29 -05:00
parent fc9994d42e
commit e3522876d7
2 changed files with 4 additions and 2 deletions

View File

@@ -46,8 +46,10 @@ exports.getallPostsforUser = (req, res) => {
myPosts.forEach(function(doc) {
posts.push(doc.data());
});
posts.sort((a, b) => -a.createdAt.localeCompare(b.createdAt));
return res.status(200).json(posts);
})
.then(function() {
return res
.status(200)