net/http is the standard library package for HTTP networkingtype Handler interface {
ServeHTTP(http.ResponseWriter, *http.Request)
}
type HandlerFunc func(ResponseWriter, *Request)
// This is a method declaration on a function type
func (f HandlerFunc) ServeHTTP(w ResponseWriter, r *Request) {
f(w, r)
}
// Then we can define a function that conforms to that interface without
// requiring explicit implementation of ServeHTTPz§
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, world")
}
http.Template is a package for doing HTTP templatingvar form = `
<h1>Todo #</h1>
<div></div>
http.Template library to populate. It uses double bracket syntax for templating and has directives like printf to do formatting. It will pull values from the fields specified in the template, e.g. pulling the ID from the .ID field of some struct