Skip to content

Follow endpoint

Alvin Cheng edited this page Apr 23, 2023 · 2 revisions

Description

This is the follow user endpoint, this endpoint will update the follower count and the following array in the MongoDB database, hence the name. This endpoint's source code is at /endpoints/followUser.ts. Furthermore, this endpoint will expect a 'targetUser' argument for the user to follow and a 'user' argument for the user that is following. Finally, this endpoint will return a status of '401' on an invalid API key, '500' on an internal server error and '200' on success.

Example

post("http://<URL>/api/follow-user?key=<YOUR_API_KEY>", {
  targetUser: "<TARGET_USER>",
  user: "<USER>",
})
  .then((res) => {
    console.log(res);
  })
  .catch((err) => {
    console.error(err);
  });
Clone this wiki locally