API Routes - brandonflores647/Fairbnb GitHub Wiki

API Routes

Routes that access backend JSON information

Session

POST /session

  • If proper validations are present, the user is logged in

DELETE /session

  • If a user is logged in, they are logged out and their session token is removed

GET /session

  • If a session token is saved in the users browser, they're logged back in

User

GET /users/:userId(\d+)

  • If proper validations are present, JSON information of the individual user is returned

Spot

POST /spots

  • If proper validations are present, a new spot is posted to the database, and JSON information of that spot is returned.

GET /spots/all

  • Returns JSON information of all spots in the database

GET /spots/:spotId(\d+)

  • Returns JSON information of a specific spot in the database

PATCH /spots/:spotId(\d+)

  • If proper validations are present, a specific spot in the database is updated and its JSON information is returned.

DELETE /spots/:spotId(\d+)

  • If proper validations are present, a specific spot in the database is destroyed

Review

POST /reviews

  • If proper validations are present, a new review is posted to the database, and JSON information of that review is returned

PATCH /reviews/:reviewId(\d+)

  • If proper validations are present, a specific review in the database is updated, and JSON information of that review is returned

DELETE /reviews/:reviewId(\d+)

  • If proper validations are present, a specific review in the database is destroyed

Booking

POST /bookings

  • If proper validations are present, a new booking is posted to the database, and JSON information of that review is returned

PATCH /bookings

  • If proper validations are present, a specific booking in the database is updated, and JSON information of that review is returned

DELETE /bookings

  • If proper validations are present, a specific booking in the database is destroyed