<p>I'm looking to see what options you guys are using and what's the right way for production to set up an endpoint for graphql. So far I was using something like this</p>
<blockquote>
<p>`http.HandleFunc("/graphql", func(w http.ResponseWriter, r *http.Request) {
result, err := executor.Execute(context, r.URL.Query()["query"][0], variables, "")</p>
<p>if err != nil {
panic(err)
}
json.NewEncoder(w).Encode(result)
})`</p>
</blockquote>
<p>It's not what really I was looking for, but it's working. If there's any handler that you're using guys would be nice to share it, ty :)
Edit: I'm using this goql library: <a href="https://github.com/playlyfe/go-graphql" rel="nofollow">https://github.com/playlyfe/go-graphql</a></p>
<hr/>**评论:**<br/><br/>keithgrennan: <pre><p>I've had success with this library: <a href="https://github.com/neelance/graphql-go" rel="nofollow">https://github.com/neelance/graphql-go</a>
I quite like the design, they use reflection in a cool way - it results in some puzzling type errors at first but once i got the hang of it (the example they provide is essential) I found I'm quite productive with it.</p></pre>valtjo: <pre><p>I agree! I tested <a href="https://github.com/graphql-go/graphql" rel="nofollow">https://github.com/graphql-go/graphql</a> and <a href="https://github.com/playlyfe/go-graphql" rel="nofollow">https://github.com/playlyfe/go-graphql</a> but IMHO neelance/graphql-go is the best.</p></pre>
