|
|
|
@ -19,7 +19,8 @@ import (
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func GraphiQLHandler() func(http.ResponseWriter, *http.Request) {
|
|
|
|
|
graphiql_string := `
|
|
|
|
|
return func(w http.ResponseWriter, r * http.Request) {
|
|
|
|
|
graphiql_string := fmt.Sprintf(`
|
|
|
|
|
<!--
|
|
|
|
|
* Copyright (c) 2021 GraphQL Contributors
|
|
|
|
|
* All rights reserved.
|
|
|
|
@ -33,9 +34,9 @@ func GraphiQLHandler() func(http.ResponseWriter, *http.Request) {
|
|
|
|
|
<title>GraphiQL</title>
|
|
|
|
|
<style>
|
|
|
|
|
body {
|
|
|
|
|
height: 100%;
|
|
|
|
|
height: 100%%;
|
|
|
|
|
margin: 0;
|
|
|
|
|
width: 100%;
|
|
|
|
|
width: 100%%;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -79,7 +80,7 @@ func GraphiQLHandler() func(http.ResponseWriter, *http.Request) {
|
|
|
|
|
root.render(
|
|
|
|
|
React.createElement(GraphiQL, {
|
|
|
|
|
fetcher: GraphiQL.createFetcher({
|
|
|
|
|
url: 'http://localhost:8080/gql',
|
|
|
|
|
url: '%s/gql',
|
|
|
|
|
}),
|
|
|
|
|
defaultEditorToolsVisibility: true,
|
|
|
|
|
}),
|
|
|
|
@ -87,9 +88,8 @@ func GraphiQLHandler() func(http.ResponseWriter, *http.Request) {
|
|
|
|
|
</script>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|
|
|
|
|
`
|
|
|
|
|
`, r.RequestURI)
|
|
|
|
|
|
|
|
|
|
return func(w http.ResponseWriter, r * http.Request) {
|
|
|
|
|
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
|
|
|
|
w.WriteHeader(http.StatusOK)
|
|
|
|
|
io.WriteString(w, graphiql_string)
|
|
|
|
|