Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

unimal-jp/graphql-ruby-sample

Repository files navigation

GraphQL-Ruby Tutorial

This is a modified version of https://github.com/howtographql/graphql-ruby that works together with https://github.com/unimal-jp/graphql-react-apollo-sample.

Installation

Install dependencies:

bundle install

rails db:create
rails db:migrate
rails db:seed

Starting the server:

rails server -p 4000

Opening the application:

open http://localhost:4000/

Interesting Files:

Sample GraphQL Queries

List first 10 links, containing "example":

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

Creates new user:

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

Creates new user token:

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

Creates new link:

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

Creates new vote:

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published