package main import ( "html/template" "log" "net/http" ) type server struct { template *template.Template } func main() { t := template.Must(template.ParseFiles("templates/main.html")) s := server{template: t} http.HandleFunc("/", s.handleRoot) http.Handle("/resource/", http.FileServer(http.Dir("."))) log.Fatal(http.ListenAndServeTLS(":8443", "certs/localhost.cert", "certs/localhost.key", nil)) } func (s *server) handleRoot(w http.ResponseWriter, r *http.Request) { if r.RequestURI != "/" { http.NotFound(w, r) return } w.Header().Set("Content-Type", "text/html") err := s.template.Execute(w, "Devoxx") if err != nil { log.Println(err) } }