简单的Golang GraphQL服务器

huangapple go评论87阅读模式
英文:

Simple Golang GraphQL Server

问题

在Go语言中,是否存在一个简单且可工作的“Hello World!” GraphQL服务器代码?

在这个主题上存在一些教程的不足,特别是因为graphql-go/graphql目前还在开发中。

英文:

Does a simple & working "Hello World!" GraphQL server code in Go exist?

There is a deficiency in tutorials concerning that topic, especially because graphql-go/graphql is currently a work-in-progress.

答案1

得分: 6

我实际上在这个周末花了一些时间创建了一个用于本周演示的Golang GraphQL服务器,与Golang GraphQL无关。我不懂任何Golang,并且从未组建过服务器,我还加入了Neo4j,这是一次冒险。"Hello World"的示例代码如下:

https://github.com/graphql-go/graphql/blob/master/examples/hello-world/main.go

此外,我使用了graphql-go/handler来创建一个端点:

https://github.com/graphql-go/handler

最后,我添加了graphiql以便查看我的查询:

https://github.com/mnmtanish/go-graphiql

我首先让"Hello World"的示例在go-graphiql中可见,然后使用handler来公开模式。

英文:

I've actually spent a bit of time this weekend creating a golang graphql server for a presentation upcoming this week, that has nothing to do with golang graphql. I don't know any golang, and never put together a server, I also threw in Neo4j, it's been an adventure, the hello world example is the following;

https://github.com/graphql-go/graphql/blob/master/examples/hello-world/main.go

In addition I used graphql-go/handler to create an endpoint;

https://github.com/graphql-go/handler

Finally added graphiql in order to check out my queries;

https://github.com/mnmtanish/go-graphiql

I started with getting the hello world example to be visible in go-graphiql, but using the handler to expose the schema.

答案2

得分: 4

最受关注的项目是https://github.com/graphql-go/graphql,但似乎没有得到积极的开发。

我一直在关注这个看起来很有前途的实现:https://github.com/neelance/graphql-go

还有一个新的存储库,我还需要检查一下:https://github.com/playlyfe/go-graphql

英文:

The most stared project is https://github.com/graphql-go/graphql but it seems to be not actively developed.

I've been keeping an eye to this implementation that looks promising:https://github.com/neelance/graphql-go

a new repo that I still need to check: https://github.com/playlyfe/go-graphql

huangapple
  • 本文由 发表于 2016年12月13日 06:46:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/41110968.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定