In this chapter we will learn how to submit the data, from layer FrontEnd to BackEnd, so lets do it..
Prepare a new folder and a template view.html on this file needs to be defined 2 template, which are form and result. The first template (form) became as the landing page program and the contents of the invitation to submit the data.
Open file main.go, in this file 2 route handler registration.
- Route / is a landing page, show the form input.
- Route /process as a action from input, show the text.
Handler route / wrapped in a function called routeIndexGet. Within it template form in the template view.html will be rendered to view. The request in this handler is restricted to method get only, the request by method will result in a response of 400 Bad Request.
So now run the program that we have created.
Finally! Try at home.