Skip to content

Backend Routes

loFiWaterCat edited this page Sep 2, 2022 · 6 revisions

Backend Routes


HTML

  • GET / - StaticPagesController#root

API Endpoints

users

  • GET /api/users - returns the users information
  • POST /api/users - sign up the user

session

  • GET /api/session - checks if there is a user logged in
  • POST /api/session - log in the user
  • DELETE /api/session - log out the user

questions

  • GET /api/questions - returns the questions
  • GET /api/questions/:id - returns the specified question and all related answers and all related comments and votes
  • POST /api/questions - creates the question
  • PATCH /api/questions/:id - edit the question
  • DELETE /api/questions/:id - delete the question

answers

  • GET /api/answers - returns the answers (for specified user)
  • POST /api/answers - creates the answer
  • PATCH /api/answers/:id - edit the answer
  • DELETE /api/answers/:id - delete the answer

comments

  • POST /api/comments - creates the comment
  • PATCH /api/comments/:id - edit the comment
  • DELETE /api/comments/:id - delete the comment

votes

  • POST /api/votes - creates the vote (upvote)
  • DELETE /api/votes - delete the vote (downvote)

tags

  • GET /api/tags - gets the tags of the questions the user has participated in

question_tags

  • POST /api/question_tags - creates question tags, linking the two together. Use with POST or PATCH questions

Clone this wiki locally