<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>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传