Backend Routes - SouVangLee/FishNGames GitHub Wiki

Backend Routes

HTML

  • GET / StaticPagesController#root

API Endpoints

users

  • POST /api/users - user sign up
  • GET /api/users/:id - show's user's profile page

session

  • POST /api/session - log in user
  • DELETE /api/session - log out user

products

  • GET /api/categories/:category_id/ - display all the products for the specified category
  • GET /api/products/{search_input} - displays all the products that match the search input

reviews

  • GET /api/products/:product_id - display all of the reviews for the product with the given id
  • POST /api/reviews/ - current user can create a review for the product with the given id
  • PATCH /api/reviews/review_id - current user can edit their own review for the product with the given id
  • DELETE /api/reviews/review_id - current user can delete their own review for the product with the given id
  • SHOW /api/reviews/review_id - fetch the current review from the database for that specific product

cartItems

  • GET /api/cart_items - fetches all of the items for the current user
  • PATCH /api/cart_items/:id - current user can update a product in their cart
  • DELETE /api/cart_items/:id - current user can remove a product from their cart

favorites

  • GET /api/favorites - show's the current user's favorites list
  • POST /api/favorites - current user can add a product to their favorite's list
  • DELETE /api/favorites/:id - current user can remove a product from their favorite's list