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

The endpoint to get items in the shopping cart

Let's examine the shopping cart's Rest API endpoints, which help service actions that the client-side web application is dependent on. Let's start with the endpoint function, GetShoppingCartItemsEndpoint, which is responsible for getting the items in the shopping cart. The Encode step, of the isomorphic handoff procedure is performed in this endpoint function.

Here's the source listing of the GetShoppingCartItemsEndpoint function:

func GetShoppingCartItemsEndpoint(env *common.Env) http.Handler {  return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {    var cart *models.ShoppingCart    igwSession, _ := env.Store.Get(r, "igweb-session") if _, ok := igwSession.Values["shoppingCart"]; ok ...

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