1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
---
title: Welcome
---
<div class="hero">
<div class="hero-title">
<img src="{{ site.baseurl }}/graphql-ruby.png" alt="GraphQL Ruby Logo"/>
<h1>GraphQL Ruby</h1>
</div>
<div class="hero-part shaded">
<h2>Install the Gem</h2>
<div class="hero-feature">
<div class="teaser">
{% highlight bash %}
# Download the gem:
gem install graphql
# Setup with Rails:
rails generate graphql:install
{% endhighlight %}
</div>
<div class="teaser">
<p>
<a href="{{ site.baseurl}}/getting_started">Get going fast</a> with the <code><a href="https://rubygems.org/gems/graphql">graphql</a></code> gem,
battle-tested and trusted by <a href="https://githubengineering.com/the-github-graphql-api/#open-source">GitHub</a>, <a href="https://www.graphql.com/articles/graphql-at-shopify">Shopify</a>, <a href="https://www.chime.com">Chime</a>, and <a href="https://www.kickstarter.com/">Kickstarter</a>.
</p>
</div>
</div>
</div>
<div class="hero-part">
<h2>Define Your Schema</h2>
<div class="hero-feature">
<div class="teaser">
<p>
Describe your application with the
<a href="{{ site.baseurl }}/schema/definition">GraphQL schema</a>
to create a self-documenting, strongly-typed API.
</p>
</div>
<div class="teaser">
{% highlight ruby %}
# app/graphql/types/profile_type.rb
class Types::ProfileType < Types::BaseObject
field :id, ID, null: false
field :name, String, null: false
field :avatar, Types::PhotoType
end
{% endhighlight %}
</div>
</div>
</div>
<div class="hero-part shaded">
<h2>Run Queries</h2>
<div class="hero-feature">
<div class="teaser">
{% highlight ruby %}
# app/controllers/graphql_controller.rb
result = MySchema.execute(
params[:query],
variables: params[:variables],
context: { current_user: current_user },
)
render json: result
{% endhighlight %}
</div>
<div class="teaser">
<p>
<a href="{{ site.baseurl }}/queries/executing_queries">Serve queries</a> to build a great UI or webservice.
</p>
</div>
</div>
</div>
</div>
<h3 style="text-align: center;">
Add <a href="https://graphql.org">GraphQL</a> to your Ruby app. <a href="{{ site.baseurl}}/getting_started">Get Started!</a>
</h3>
|