Skip to content

Backend Routes

dsuh93 edited this page Feb 19, 2021 · 6 revisions

#Backend Routes

HTML

  • GET/ StaticPagesController#root

API Endpoints

users

  • GET/api/users/:id: returns user profile information and profile picture
  • GET/api/users/:id/checkins/:drink_id: returns all drinks user has checkedin for
  • GET/api/users/:id/checkins: returns all checkins for user profile
  • POST/api/users: sign up

session

  • POST/api/session: log-in
  • DELETE/api/session: logout

drinks

  • GET/api/drinks: returns a list of drinks for the drinks index
  • GET/api/drinks/:id: returns the show page for a specific drink, data includes name, brewery_id, type, average ratings, description, total ratings, avg ratings, total checkins, and number of checkins by current user
  • POST/api/drinks: create a drink
  • PATCH/api/drinks/:id: edit and update a drink
  • DELETE/api/drinks/:id: delete a drink
  • GET/api/drinks/:id/checkins: returns index of all checkins for drink show page (nested)

brewery

  • GET/api/breweries: returns a list of breweries for the search bar
  • GET/api/breweries/:id: returns a show page for a specific brewery, data includes name, logo, location, average ratings, total beers
  • POST/api/breweries: create a brewery
  • PATCH/api/breweries/:id: edit a brewery
  • DELETE/api/breweries/:id: delete a brewery
  • GET/api/breweries/:id/checkins: returns index of all checkins for brewery show page (nested)
  • GET/api/breweries/:id/drinks: returns all drinks for brewery show page (nested)

checkins

  • GET/api/checkins: returns relevant checkins (filtered by created_at), includes toasts and comments
  • GET/api/checkins/:id: returns a information for a checkin show page, including number of toasts and comments
  • POST/api/checkins: create a checkin
  • DELETE/api/checkins/:id: delete a checkin

comments

  • POST/api/comments: create a comment
  • PATCH/api/comments/:id: edit a comment
  • DELETE/api/comments:id: delete a comment

toasts

  • POST/api/toasts: toast a checkin
  • DELETE/api/toasts/:id: untoast a checkin

note: comments and toasts don't include a GET route because these routes render the api/checkins/show.json.jbuilder view

Clone this wiki locally