知海

Ruby:Agoo(服务端)

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

Ruby:Agoo(服务端)

描述: 一个支持 GraphQL 的高性能 Web 服务器。Agoo 致力于为 GraphQL 提供简单易用的 API。

链接: GitHub · Gem: agoo

ruby 复制代码
require 'agoo'

class Query
  def hello
    'hello'
  end
end

class Schema
  attr_reader :query

  def initialize
    @query = Query.new()
  end
end

Agoo::Server.init(6464, 'root', thread_count: 1, graphql: '/graphql')
Agoo::Server.start()
Agoo::GraphQL.schema(Schema.new) {
  Agoo::GraphQL.load(%^type Query { hello: String }^)
}
sleep

# To run this GraphQL example type the following then go to a browser and enter
# a URL of localhost:6464/graphql?query={hello}
#
# ruby hello.rb

帮助我们改进文档

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