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 product detail page

Let's examine the productdetail.go source file found in the handlers directory:

package handlersimport (  "net/http"  "github.com/EngineerKamesh/igb/igweb/common"  "github.com/EngineerKamesh/igb/igweb/shared/templatedata"  "github.com/gorilla/mux"  "github.com/isomorphicgo/isokit")func ProductDetailHandler(env *common.Env) http.Handler {  return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {    vars := mux.Vars(r)    productTitle := vars["productTitle"]    product := env.DB.GetProductDetail(productTitle)    templateData := &templatedata.ProductDetail{PageTitle: product.Name, Product: product}    env.TemplateSet.Render("product_detail_page", &isokit.RenderParams{Writer: w, Data: templateData})

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