package types import ( "html/template" "io" "net/http" ) type option struct { Text string Arc string } type arc struct { Title string Story []string Options []option } type story map[string]arc type Config struct { Story story Template *template.Template } func (cfg Config) ServeHTTP(w http.ResponseWriter, r *http.Request) { arc := r.PathValue("arc") title := cfg.Story[arc].Title w.Header().Set("Content-Type", "text/plain") io.WriteString(w, title) }