Skip to content
Chris Kim edited this page Sep 18, 2017 · 2 revisions

Routes

API Endpoints

users

  • GET /api/user - Retrieves information for that user when you want to see his/her profile.
  • POST /api/users - Signs up a new user.
  • PATCH /api/users/:id - Updates a user's information to be displayed in the user profile page.

lodgings

  • GET /api/lodgings - Retrieves all of the lodgings in the database (formatted simply via json.jbuilder).
  • GET /api/lodgings/:id - Retrieves more detailed information for a particular lodging while others in the same slice of state still has small amounts of information.
  • POST /api/lodgings - Created a new lodging based on information inputed into a form.
  • DELETE /api/lodgings/:id - Deletes a lodging of the current user who is signed in.
  • PATCH /api/lodgings/:id - Updates the lodging based on information using a form.

bookings

  • GET api/:user_id/bookings - Retrieves all of the bookings for the current user (ONLY CURRENT USER).
  • DELETE /api/bookings/:id - Deletes a booking if the booking is owned by the current user.
  • PATCH /api/bookings/:id - Updates a booking with new information if the booking is owned by the current user.
  • POST /api/bookings - Creates a new booking.

reviews

  • GET api/:lodging_id/reviews - Retrieves all of the reviews for a particular lodging.
  • DELETE api/:lodging_id/reviews/:id - Deletes a particular review.
  • PATCH api/:lodging_id/reviews/:id - Modifies an existing reviewer that the current user created.

Frontend Routers

  • /login
  • /signup
  • / - Renders the index of all of the lodgings available.
  • /lodgings/new - To create a new lodging.
  • /lodgings/:lodgingId - Renders the lodging profile page that also has the reviews for the lodging on the bottom of the page.
  • /lodgings/:lodgingId/edit - Edits a lodging.`
  • /lodgings/new - Renders a form to create a new lodging for the current user.
  • /users/:userId - Renders the profile page for a particular user.
  • /users/:userId/edit - Edits the attributes for the current user only. Can it be just /users/edit since only the current user can edit his/her own attributes?
  • /users/:userId/bookings - See all of the bookings for the current user. Maybe I can use /bookings instead. The user creates the booking when he/she is on the display page for a particular lodging.

Clone this wiki locally