March 2019
Intermediate to advanced
336 pages
9h 9m
English
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 bookpackage main// importing fmt, database/sql, net/http, text/template packageimport ( "net/http" "text/template" "log")// Home method renders the main.htmlfunc 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 methodfunc main() { ...
Read now
Unlock full access