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

Implementing the shopping cart functionality on the client side

To fulfill the Register step of the ERDA strategy, we will register the /shopping-cart  route and its associated handler function, ShoppingCartHandler, inside the registerRoutes function found in the client/client.go source file:

r.Handle("/shopping-cart", handlers.ShoppingCartHandler(env))

Remember that this route will kick-in when a user access the shopping cart by clicking on the shopping cart icon in the navigation bar. Upon clicking the shopping cart icon, the ShoppingCartHandler function will be called.

Let's take a look at the ShoppingCartHandler function:

func ShoppingCartHandler(env *common.Env) isokit.Handler {  return isokit.HandlerFunc(func(ctx context.Context) {

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