Cart endpoints

Now, let's document the cart section with the list of products in the cart:

  @ApiOperation(value = "List the product in the cart", consumes =     "text/plain")
  @ApiResponses(Array(new ApiResponse(code = 200, message = "Product     added"),
    new ApiResponse(code = 401, message = "unauthorized, please login     before to proceed"),
    new ApiResponse(code = 500, message = "Internal server error,     database error")))
  def listCartProducts() = Action.async { request =>

If we call listCartProducts, we receive an empty array. To test it with some products, complete the declaration of addCartProduct with the following:

  @ApiOperation(value = "Add a product in the cart", consumes =  "text/plain") @ApiResponses(Array(new ApiResponse(code = 200, message ...

Get Scala Programming Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.