graphql-ruby

by howtographql

howtographql / graphql-ruby

GraphQL Ruby example for How To GraphQL

221 Stars 48 Forks Last release: Not found MIT License 83 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

graphql-ruby

Installation

Install dependencies:

bundle install

rails db:setup

Starting the server:

rails server

Opening the application:

open http://localhost:3000/

Interesting Files:

Sample GraphQL Queries

List first 10 links, containing "example":

{
  allLinks(first: 10, filter: {descriptionContains: "example"}) {
    id
    url
    description
    createdAt
    postedBy {
      id
      name
    }
  }
}

Creates new user:

mutation {
  createUser(
    name: "Radoslav Stankov",
    authProvider: {
      email: { email: "[email protected]", password: "123456" }
    }
  ) {
    id
    email
    name
  }
}

Creates new user token:

mutation {
  signinUser(email: {email: "[email protected]", password: "123456"}) {
    token
    user {
      id
      email
      name
    }
  }
}

Creates new link:

mutation {
  createLink(url:"http://example.com", description:"Example") {
    id
    url
    description
    postedBy {
      id
      name
    }
  }
}

Creates new vote:

mutation {
  createVote(linkId:"TGluay0yMQ==") {
    user {
      id
      name
    }
    link {
      id
      url
      description
    }
  }
}

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.