Skip to content

Backend Routes

Kevin Le edited this page Mar 24, 2022 · 17 revisions

Backend Routes

HTML

  • GET / - StaticPagesController#root

API Endpoints

users

  • GET /api/users - returns all users information
  • GET /api/users/:id - returns information for a specific user
  • POST /api/users - signup
  • PATCH /api/users/:id - edit information for a specific user (only if the user is the current user)

session

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

questions

  • GET /api/questions - display page of all questions
  • GET /api/questions/:question_id - display page of one specific question
  • POST /api/questions - user will create(ask) a question
  • PATCH /api/questions/:question_id - edit question text (only if the current user is the asker)
  • DELETE /api/questions/:question_id - delete question (only if the current user is the asker)

answers

  • GET /api/questions/:question_id/answers - display answers for a given question
  • POST /api/answers - user will create an answer (answer a question)
  • PATCH /api/answers/:id - edit answer text (only if the current user is the answerer)
  • DELETE /api/questions/:id - delete answer (only if the current user is the answerer)

votes

  • POST /api/votes - upvote or downvote a question
  • DELETE /api/votes/:id - undo upvote/downvote

Clone this wiki locally