package handler
import (
"html/template"
"net/http"
)
var page = template.Must(template.New("graphiql").Parse(`
{{.title}}
`))
func Playground(title string, endpoint string) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
err := page.Execute(w, map[string]string{
"title": title,
"endpoint": endpoint,
"version": "1.7.8",
})
if err != nil {
panic(err)
}
}
}