<p>Hi all,</p>
<p>Recently I've thrown myself into the world of Go, so far I'm very happy with every aspect.</p>
<p>I'm looking to create a GraphQL Server for a project I am working on, after a bit of research it seems <a href="https://github.com/graph-gophers/graphql-go" rel="nofollow">graph-gophers/graphql-go</a> is much-preferred over <a href="https://github.com/graphql-go/graphql" rel="nofollow">graphql-go/graphql</a>. The problem is, the lib doesn't seem to be documented or have many well-made examples.</p>
<p>The closest example of what I'm looking to achieve has been <a href="https://github.com/tonyghita/graphql-go-example" rel="nofollow">tonyghita/graphql-go-example</a> from the readme, which even includes a wrapper around an existing REST API which I will need. While this will probably suffice, I'm just curious if anyone has any other examples that may help?</p>
<p>For anyone interested, the stack on the Back-End of this project will be:</p>
<ul>
<li>Go</li>
<li>GraphQL API (consumed on the Front-End by React/React Native with Apollo)</li>
<li>MySQL DB (any reason I should use Postgres instead?)</li>
</ul>
<p>Thanks!</p>
<hr/>**评论:**<br/><br/>zellyn: <pre><p>I found <a href="https://github.com/deltaskelta/graphql-go-pets-example" rel="nofollow">https://github.com/deltaskelta/graphql-go-pets-example</a> to be slightly too simple (everything in one package) and <a href="https://github.com/tonyghita/graphql-go-example" rel="nofollow">https://github.com/tonyghita/graphql-go-example</a> to be a little too complex/“productionized” — it's clear they factored everything out into separate logical packages, but without a bit of narrative, it's difficult to understand <em>why</em> without investing some time. eg. what is the <code>swapi</code> package for? The simple example is probably a good starting point if you're aiming to build something simple (I'm not).</p>
<p>I'm now gravitating towards <code>gqlgen</code> as mentioned in another comment.</p>
<p>As for MySQL vs Postgres, it's a bit of a holy war. As I understand it, Postgres has a history of being more correct, and MySQL has a history of being easier to manage and understand operationally. Both have made big recent strides in implementing the aspects they lacked compared to the other. I would use whichever one you feel more comfortable with and/or whichever one most people you would ask for help are more comfortable with. At work, we use MySQL almost exclusively, and recently ported an app from Postgres to MySQL, but that's mostly because our DB folks are magic at maintaining MySQL and building tooling for it, and our institutional knowledge/skill running Postgres is very thin.</p></pre>fade1450: <pre><p><a href="https://github.com/vektah/gqlgen" rel="nofollow">https://github.com/vektah/gqlgen</a> could be worth a look.</p></pre>zellyn: <pre><p>I've spent the last couple of mornings reading graphql docs and gqlgen tutorials. It looks very nice.</p>
<p>Beware that there are a few issues with differences between the code and tutorials: <a href="https://github.com/vektah/gqlgen-tutorials/issues/2" rel="nofollow">https://github.com/vektah/gqlgen-tutorials/issues/2</a>. I think most of the problem is me learning to think in graphql.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传