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 handler function for the products listing page

Let's examine the ProductsHandler function in the products.go source file found in the client/handlers directory:

func ProductsHandler(env *common.Env) isokit.Handler {  return isokit.HandlerFunc(func(ctx context.Context) {    productsChannel := make(chan []*models.Product)    go FetchProducts(productsChannel)    products := <-productsChannel    templateData := &templatedata.Products{PageTitle: "Products", Products: products}    env.TemplateSet.Render("products_content", &isokit.RenderParams{Data: templateData, Disposition: isokit.PlacementReplaceInnerContents, Element: env.PrimaryContent, PageTitle: templateData.PageTitle})    InitializeProductsPage(env)    env.Router.RegisterLinks("#primaryContent a")  })}

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