O'Reilly logo

Isomorphic Go by Kamesh Balasubramanian

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

Adding an item

For adding an item to the shopping cart, we will register the /restapi/add-item-to-cart endpoint:

r.Handle("/restapi/add-item-to-cart", endpoints.AddItemToShoppingCartEndpoint(env)).Methods("PUT")

This route will be handled by the AddItemToShoppingCartEndpoint handler function. Note that since we are performing a mutating operation on the web server (adding a shopping cart item), we use the HTTP PUT method when calling this endpoint.

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