package main import ( "html/template" "log" "net/http" ) var x = 2 func main() { http.HandleFunc("/data", func(w http.ResponseWriter, req *http.Request) { w.WriteHeader(200) const tpl = `
Hey check out the data
` t, err := template.New("default").Parse(tpl) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } err = t.Execute(w, nil) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } }) http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) { w.WriteHeader(200) // fmt.Fprintf(w, "Welcome to the home page!") const tpl = `