Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 550 Bytes

File metadata and controls

34 lines (25 loc) · 550 Bytes
name description github gem
graphql-ruby
A Ruby library for building GraphQL APIs.
rmosolgo/graphql-ruby
graphql

To run a hello world script with graphql-ruby:

gem install graphql

Then run ruby hello.rb with this code in hello.rb:

require 'graphql'

class QueryType < GraphQL::Schema::Object
  field :hello, String

  def hello
    "Hello world!"
  end
end

class Schema < GraphQL::Schema
  query QueryType
end

puts Schema.execute('{ hello }').to_json

There are also nice bindings for Relay and Rails.