JuanitoFatas / graphql-ruby-1

GraphQL Ruby example for How To GraphQL

Home Page:https://www.howtographql.com/graphql-ruby/0-introduction/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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: {
      credentials: { email: "rado@example.com", password: "123456" }
    }
  ) {
    id
    email
    name
  }
}

Creates new user token:

mutation {
  signinUser(credentials: {email: "rado@example.com", 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
    }
  }
}
ezoic increase your site revenue

About

GraphQL Ruby example for How To GraphQL

https://www.howtographql.com/graphql-ruby/0-introduction/

License:MIT License


Languages

Language:Ruby 87.3%Language:HTML 12.5%Language:JavaScript 0.2%