Build GraphQL Server with Ruby
*Source: How To GraphQL
Built my own GraphQL server using the following technologies:
- Ruby on Rails: the most popular library for building applications in Ruby
- GraphQL Gem: the most popular library for building GraphQL applications
- GraphiQL: An in-browser IDE for exploring GraphQL, which comes bundled with GraphQL Gem
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
}
}
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