package playground import ( "html/template" "net/http" ) var altairPage = template.Must(template.New("altair").Parse(` {{.title}}
Altair
`)) // AltairHandler responsible for setting up the altair playground func AltairHandler(title, endpoint string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { err := altairPage.Execute(w, map[string]interface{}{ "title": title, "endpoint": endpoint, "endpointIsAbsolute": endpointHasScheme(endpoint), "subscriptionEndpoint": getSubscriptionEndpoint(endpoint), "version": "5.0.5", "cssSRI": "sha256-kZ35e5mdMYN5ALEbnsrA2CLn85Oe4hBodfsih9BqNxs=", "mainSRI": "sha256-nWdVTcGTlBDV1L04UQnqod+AJedzBCnKHv6Ct65liHE=", "polyfillsSRI": "sha256-1aVEg2sROcCQ/RxU3AlcPaRZhZdIWA92q2M+mdd/R4c=", "runtimeSRI": "sha256-cK2XhXqQr0WS1Z5eKNdac0rJxTD6miC3ubd+aEVMQDk=", }) if err != nil { panic(err) } } }