Skip to content

Commit

Permalink
Change user friends to all users in rightBar
Browse files Browse the repository at this point in the history
  • Loading branch information
YKizou committed Mar 20, 2022
1 parent 25cc794 commit 6871256
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions routes/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,19 @@ router.get("/:id", async(req, res)=>{

});

// get all users
router.get("/all/:id", async(req, res)=>{
try{
const users = await User.find();
const filtered = users.filter(function(el) { return el._id != req.params.id; });

res.status(200).json(filtered);
}catch(err){
res.status(500).json(err)
}

});

// follow a user
router.put("/:id/follow", async(req, res)=>{
if(req.params.id !== req.body.userId) {
Expand Down

0 comments on commit 6871256

Please sign in to comment.