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 contact route handler

The ContactHandler is responsible for rendering the contact page on IGWEB, where the contact form will reside:

func ContactHandler(env *common.Env) http.Handler {  return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {

We declare and initialize the formParams variable to a newly initialized FormParams instance, providing the values for the ResponseWriter and Request fields:

    formParams := isokit.FormParams{ResponseWriter: w, Request: r}

We then declare and initialize the contactForm variable, with a newly created ContactForm instance, by calling the NewContactForm function and passing in the reference to the formParams struct:

    contactForm := forms.NewContactForm(&formParams)

We switch on the type ...

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