Skip to content

Backend Routes

DavidWoolner edited this page Sep 3, 2021 · 8 revisions

Backend Routes

HTML

  • GET/ StaticPagesController#root

API Endpoints

Users

  • GET /api/users/:id - returns bookings and listings for a single user
  • POST /api/users - signs up a new user, and returns their info
  • PATCH /api/users/:id - updates a user's profile
  • DELETE /api/users/:id - deletes a user's profile

session

  • POST /api/session - log in - returns current user info
  • DELETE api/session - log out

listings

  • GET /api/listings/ - index to be filtered by search criteria
  • GET /api/listings/:id - show page
  • POST /api/listings/ - create a new listing
  • PATCH /api/listings/:id - update a listing
  • DELETE /api/listings/:id - delete a listing

bookings

  • GET /api/users/:id - get a specific booking by id
  • POST /api/bookings - add a new booking to listings
  • PATCH /api/users/:user_id/bookings/:bookings_id - allows a user to update their booking
  • DELETE /api/bookings/:id - allows a user to cancel a booking

reviews

  • GET /api/listings/:listing_id/reviews - fetches all reviews for a listing
  • POST /api/listings/:listing_id/reviews - creates a new review under a listing
Clone this wiki locally