Backend Routes - arleenpandher/Herozon GitHub Wiki

Backend Routes

HTML

  • GET / - StaticPagesController#root

API Endpoints

users

  • GET /api/users/:id - returns the user profile
  • GET /api/users/:id/reviews - see all the reviews the user has posted
  • GET /api/users/:id/products - see all the products a user has purchased
  • POST /api/users - sign up

carts

  • GET /api/carts/:id - returns all the items in that particular user's cart
  • POST /api/carts/:id - add a specific item to a specific user's cart
  • PATCH /api/carts/:id - edit the details of a specific item in specific user's cart (eg. quantity)
  • DELETE /api/carts/:id - remove a specific item in specific user's cart (eg. quantity)

session

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

products

  • GET /api/products - returns the product home page
  • GET /api/products/id - return product specific page
  • GET /api/products/id/reviews - returns the reviews associated with a product
  • GET /api/products/id/reviews/id - returns a specific review for a product

reviews

  • POST /api/reviews - create a review for a specific product
  • PATCH /api/reviews/:id - edit a review for a specific product
  • DELETE /api/reviews/:id - remove a review for a specific product