In this section, we will explain web forms using basic examples, showing you how to perform various actions.
To start a basic HTML page with the Go net/http package, the web forms example is as follows (webforms.go). This has a welcome greeting in main.html:
//main package has examples shown
// in Hands-On Data Structures and algorithms with Go book
package main
// importing fmt, database/sql, net/http, text/template package
import (
"net/http"
"text/template"
"log")
// Home method renders the main.html
func Home(writer http.ResponseWriter, reader *http.Request) {
var template_html *template.Template
template_html = template.Must(template.ParseFiles("main.html"))
template_html.Execute(writer,nil)
}
// main method
func main() {
log.Println("Server started on: http://localhost:8000")
http.HandleFunc...