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

Registering the contact route

We start out by adding the routes for the contact form page and the contact confirmation page:

  r.Handle("/contact", handlers.ContactHandler(env)).Methods("GET", "POST")  r.Handle("/contact-confirmation", handlers.ContactConfirmationHandler(env)).Methods("GET")

Note that the /contact route that we have registered, which will be handled by the ContactHandler function, will accept HTTP requests using both the GET and the POST method. When the contact form is first accessed, it will be through a GET request to the /contact route. When the user submits the contact form, they will initiate a POST request to the /contact route. This explains why this route accepts both of these HTTP methods.

Upon successfully filling ...

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