Backend Routes - melflynn/BarkedIn GitHub Wiki

HTML

  • GET /StaticPagesController#root

API Endpoints

Users

  • GET /api/users - check for an email in the database, list of people you may know, user search feature
  • GET /api/user/:id - user profile page
  • POST /api/users - sign up new user
  • PATCH /api/users/:id - Edit a user's info, such as location, job_title or bio
  • DELETE /api/users/:id - Purge a profile photo from a user

Session

  • GET /api/session - login
  • DELETE /api/session - logout

Connections

  • GET api/connections - find a connection between two users
  • POST api/connections - initiate a connection request
  • PATCH api/connections/:id - change the status of a connection from 'pending' to 'connected'
  • DELETE api/connections/:id - remove an existing connection (can only be performed by the current_user with the user_id or connection_id from the connection)

Posts

  • GET /api/posts - list of all posts - for news feed. This can include reactions, thus get requests for those data pieces should not be necessary
  • POST /api/posts - Add a post to the news feed/user activity (should be linked by author_id to the current_user)
  • PATCH /api/posts/:id - Edit an existing post (should only be accessible if the author_id is the current_user's id)
  • DELETE /api/posts/:id - Remove a post (and all its dependent comments) from the news feed/user activity (should only be accessible if the author_id is the current_user's id)

Comments

  • GET /api/comments - Retrieve comments related to a single post when a user clicks to expand comments (a few comments should be displayed before the user clicks in, and only a few more comments will display each time a user selects to see more, reactions will be fetched with comments)
  • POST /api/comments - Add a comment to a post, or reply to a comment
  • PATCH /api/posts/:id - Edit a comment (only accessible if the author_id matches the current_user's id)
  • DELETE /api/posts/:id - Remove a comment (and all its dependent replies) from a post (only accessible if the author_id matches the current_user's id)

Reactions

  • POST /api/reactions - Add a reaction to a comment or post
  • PATCH /api/reactions/:id - Change the type of a reaction (only accessible if the author_id matches the current_user's id)
  • DELETE /api/posts/:id - Remove a reaction from a post or comment (only accessible if the author_id matches the current_user's id)

skills

  • POST /api/skills - Add a user_skill that is not already defined

user_skills

  • POST /api/user_skills - Add a skill to a user's list of skills
  • DELETE /api/user_skills/:id - Remove a skill from a user's list of skills