Skip to content

Backend routes

wcorona269 edited this page Apr 25, 2022 · 3 revisions

Backend Routes

HTML

  • GET / StaticPagesController#root

API Endpoints

users

  • POST /api/users - new user sign-up
  • GET /api/users/:id - current user profile with past & upcoming reservations (with reviews attached if a user left one), and saved restaurants.
  • PATCH /api/users/:id - current user edit page

session

  • POST /api/session - user login
  • DELETE api/session - logout. returns to login page

restaurants

  • GET /api/restaurants/ - general 'get' route for listing restaurants on home page
  • GET /api/restaurants/:id - restaurant page with information on menu, reviews, calendar, photos
  • GET /api/restaurants/search - custom route for restaurant search. lists all that match query string.

reviews

  • POST /api/reviews - write review for a specific restaurant (logged-in users)
  • GET /api/restaurants/:rest_id/reviews - reviews list for a specific restaurant (displayed on a restaurant's page)
  • PATCH /api/reviews/:id - allow logged-in users to edit previous reviews they left
  • DELETE /api/reviews/:id - allow logged-in users to delete previous reviews they left

reservations

  • POST /api/rsvps - allow logged-in users to create future reservations for themselves
  • GET /api/rsvps/:id - allow logged-in users to view a specific reservation they've made
  • PATCH /api/rsvps/:id - allow logged-in users to edit an upcoming reservation
  • DELETE /api/rsvps/:id - allows logged-in to delete an upcoming reservation from their profile

saved restaurants

  • POST /api/saved - allow logged-in users to add a restaurant to their saved list
  • DELETE api/saved/:id - allow logged-in users to unsave a restaurant
Clone this wiki locally