· api development graphql ruby

Build GraphQL Server with Ruby

RGraphQL with Ruby
TUTORIAL LINK


*Source: How To GraphQL

Built my own GraphQL server using the following technologies:

Resources

GraphQL Queries Run

# Welcome to GraphiQL
#
# Keyboard shortcuts:
#
#  Prettify Query:  Shift-Ctrl-P (or press the prettify button above)
#  Run Query:  Ctrl-Enter (or press the play button above)
#  Auto Complete:  Ctrl-Space (or just start typing)
#

query getAllLinks {
  allLinks {
    id
    url
    description
        postedBy {
      name
      votes {
        link {
          description
        }
      }
    }
  }
}

query allLinksFilter {
  allLinks(filter: {descriptionContains: "testing"
  OR: {descriptionContains: "best"}
  }) {
    description
  }
}

query LinksPagination {
  allLinks(first: 1, skip: 1) {
    id
  }
}

# https://www.howtographql.com/graphql-ruby/3-mutations
mutation addNewLink {
  createLink(
    url: "http://npmjs.com/package/graphql-tools",
    description: "Best tools!",
  ) {
    id
    url
    description
    postedBy {
      id
      name
    }
  }
}

mutation createUser {
  createUser(
    name: "Andrew Goss",
    authProvider: {
      email: {
        email: "[email protected]",
        password: "dumb_password"
      }
    }
  ) {
    id
    email
    name
  }
}

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

mutation createLink {
  createLink(
    url: "http://localhost:3000/graphiql",
    description: "Your testing playground",
  ) {
    id
    url
    description
    postedBy {
      id
      name
    }
  }
}

mutation createVote {
  createVote(linkId:"5") {
    link {
      description
    }
    user {
      name
    }
  }
}

mutation createInvalidLink {
  createLink(url:"", description:"") {
    id
  }
}


View my code on GitHub


About Me

I'm a data leader working to advance data-driven cultures by wrangling disparate data sources and empowering end users to uncover key insights that tell a bigger story. LEARN MORE >>



comments powered by Disqus