Backend Routes - franadam/Twitter-Clone GitHub Wiki

API Endpoints

auth

  • POST /api/users/register - sign up a user
  • POST /api/users/login - sign in a user

users

  • GET /api/users/:username - returns the user information including tweets and likes
  • PATCH /api/users/:username - update user profile
  • DELETE /api/users/current - delete the user account

likes

  • GET /api/users/:id/likes - get the user's likes

avatar

  • GET /api/users/:id/avatar - get the user's avatar
  • POST /api/users/:id/avatar - add an avatar on the profile
  • DELETE /api/users/:id/avatar - delete the avatar

cover

  • GET /api/users/:id/cover - get the user's cover
  • POST /api/users/:id/cover - add an cover on the profile
  • DELETE /api/users/:id/cover - delete the cover

follows

  • GET /api/users/:id/follows - get the user's followers and following
  • POST /api/users/:id/follows - follow a user
  • DELETE /api/users/:id/follows - unfollow a user

tweets

  • GET /api/tweets - returns the all the tweets
  • POST /api/tweets - create a tweet
  • GET api/tweets/user/:username - returns the all the tweets from a user
  • GET /api/tweets/:id - return a tweet
  • DELETE /api/tweets/:id - delete a tweet
  • GET /api/tweets/:id/comments - return all the tweet comments

likes

  • GET /api/tweets/:id/likes - return all the likes from a tweet
  • POST /api/tweets/:id/likes - like a tweet
  • DELETE /api/tweets/:id/likes - unlike a tweet