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

Rendering the about page from the client side

Here's the definition of the client-side AboutHandler function in the about.go source file found in the client/handlers folder:

func AboutHandler(env *common.Env) isokit.Handler {  return isokit.HandlerFunc(func(ctx context.Context) {    gopherTeamChannel := make(chan []*models.Gopher)    go FetchGopherTeam(gopherTeamChannel)    gophers := <-gopherTeamChannel    templateData := templatedata.About{PageTitle: "About", Gophers: gophers}    env.TemplateSet.Render("about_content", &isokit.RenderParams{Data: templateData, Disposition: isokit.PlacementReplaceInnerContents, Element: env.PrimaryContent, PageTitle: templateData.PageTitle})    InitializeAboutPage(env)  })}

We start out by creating a channel, gopherTeamChannel ...

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