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 server side

Now that we've seen how the server-side application transmits the template bundle to the client-side application, let's take a look at the AboutHandler function found in the about.go source file in the handlers folder. This is the server-side handler function that is responsible for rendering the About page:

func AboutHandler(env *common.Env) http.Handler {  return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {    gophers := env.DB.GetGopherTeam()    templateData := templatedata.About{PageTitle: "About", Gophers: gophers}    env.TemplateSet.Render("about_page", &isokit.RenderParams{Writer: w, Data: templateData})  })}

The AboutHandler function has three responsibilities:

  • Fetching the gophers ...

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