O'Reilly logo

Scala Programming Projects by Nicolas Jorand, Mikael Valot

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required