Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

graphql-ruby

> 后端框架
Open source

GraphQL Ruby example for How To GraphQL

266 stars0 likes1 views
WebsiteGitHub

About

GraphQL Ruby example for How To GraphQL

graphql-ruby

Installation

Install dependencies:

bundle install

rails db:setup

Starting the server:

rails server

Opening the application:

open http://localhost:3000/

Interesting Files:

  • GraphqlController - GraphQL controller (api entry point)
  • GraphqlTutorialSchema - the schema definition
  • Mutations - root mutations
  • Queries - root queries
  • UserType - record type
  • VoteType - record type
  • LinkType - record type
  • DateTimeType - scalar type
  • LinksSearch - complex search resolver and its tests
  • CreateLink - mutation and its tests
  • CreateUser - mutation and its tests
  • CreateVote - mutation and its tests
  • SignInUser - mutation and its tests

Sample GraphQL Queries

List first 10 links, containing "example":

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

Creates new user:

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

Creates new user token:

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

Creates new link:

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

Creates new vote:

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

Issues· 4 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rubygraphqlgraphql-serverrailsruby

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category后端框架
PricingOpen source

> Related tools

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架