知海

Scala:Sangria(服务端)

graphql-github-io-zh-Hans生态项目与库

Scala:Sangria(服务端)

描述: 一个支持 Relay 的 Scala GraphQL 库。

链接: 官网 · GitHub

使用 sangria 构建 Hello World GraphQL schema 和查询的示例:

scala 复制代码
import sangria.schema._
import sangria.execution._
import sangria.macros._

val QueryType = ObjectType("Query", fields[Unit, Unit](
  Field("hello", StringType, resolve = _ ⇒ "Hello world!")
))

val schema = Schema(QueryType)

val query = graphql"{ hello }"

Executor.execute(schema, query) map println

帮助我们改进文档

发现翻译问题或内容错误?请告诉我们。