backend routes - Patrick-Mondala/facebook-clone GitHub Wiki

Backend Routes

HTML

  • GET / StaticPagesController#root

API Endpoints

users

  • POST /api/users - sign up
  • GET /api/users/:userId - returns the user information
  • PATCH /api/users/:userId - edit user information
  • User Search Feature
    • GET /api/users - returns list of users
    • POST /api/users/:name - returns users that match the name wildcard
    • POST /api/users/:userId/:name - returns friends of current_user that match the name wildcard

session

  • POST /api/session - log in
  • DELETE /api/session - log out

friendships

  • POST /api/friendships - create a friendship request
  • PATCH /api/friendships/:friendshipId - accept friendship request
  • DELETE /api/friendships/:friendshipId - remove/reject a friendship request

posts

  • GET /api/posts - return posts on current_user and their friends timelines
  • GET /api/posts/:postId - return post
  • GET /api/users/:userId/posts - return posts from userId timeline
  • POST /api/users/:userId/posts - creates a post on userId timeline
  • PATCH /api/posts/:postId - edit a post
  • DELETE /api/posts/:postId - remove a post

comments

  • GET /api/posts/:postId/comments - return comments on post
    • comments will be rendered in post show so might be deprecated later
  • POST /api/posts/:postId/comments - create a comment on a post
  • PATCH /api/comments/:commentId - edit a comment
  • DELETE /api/comments/:commentId - remove a comment
    • child comments also removed

tags

  • POST /api/tags - create a tag
  • DELETE /api/tags/:tagId - remove a tag

likes

  • POST /api/likes - create a like
  • DELETE /api/likes/:likeId - remove a like