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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.