package main import ( "embed" "html/template" "log" "net/http" ) type EmojiDetails struct { Label string } //go:embed templates var indexHTML embed.FS func main() { tmpl := template.Must(template.ParseFS(indexHTML, "templates/index.html")) http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { if r.Method != http.MethodPost { tmpl.Execute(w, nil) return } details := EmojiDetails{ Label: r.FormValue("label"), } log.Print(details.Label) tmpl.Execute(w, struct{ Success bool }{true}) }) http.ListenAndServe(":8080", nil) }