Shows an implementation of GraphQL via graphql-ruby.
- Try it on heroku.
- Schema is defined in
/app/graph
. - Queries are served by
queries#create
. - GraphiQL IDE is served by graphiql-rails
Use graphql-ruby to expose a Rails app
Shows an implementation of GraphQL via graphql-ruby.
/app/graph
.queries#create
.Would it be valuable to support the same behaviour as implemented in graphql/swapi-graphql project? Users will be able to run the same example queries and compare implementations.
I've been having a heck of a time over the last couple of days trying execute a Relay query to fetch a node via id. I have been able to reproduce the problem with this project (even running GraphiQL from the Heroku hosted project). Basically, if you try to execute the query located in https://github.com/rmosolgo/graphql-ruby-demo/blob/master/app/graph/queries/introQuery.graphql, you get the following error:
{
"errors": [
{
"message": "Something went wrong during query execution: wrong number of arguments (given 2, expected 1)"
}
]
}
In my own code, I have updated it to use the github repository for graphql-ruby instead of the gem. Now I get a different error:
{
errors: [
{
"message": "Internal error"
}
]
}
Not sure what is going on here. I thought I was doing something wrong, but I'm assuming the query above should work, so perhaps it's a bug?
i was try your app in local its work but when i check ur app on heroku it does not work please would you like to check that is error and why
i am new in GraphQL and Rails so i could find it yet
NodeIdentification as defined in app/graph/types/node_identification.rb
is outdated and can be removed, see http://rmosolgo.github.io/graphql-ruby/relay/object_identification
# Todo: handle code reloads!
GraphQL::Relay::GlobalNodeIdentification.instance_variable_set(:@instance, nil)
NodeIdentification = GraphQL::Relay::GlobalNodeIdentification.define do
object_from_id -> (id, ctx) do
type_name, id = NodeIdentification.from_global_id(id)
type_name.constantize.find(id)
end
type_from_object -> (object) do
StarWarsSchema.types[object.class.name]
end
end
When running the demo on heroku or on localhost I get the following error.
Don't know how to get the GraphQL type of a Droid
@rmosolgo - In this demo, how does graphiql get the schema to show you on the right side bar? Does it do an implicit introspection query when it starts up?
I would like to beef up this application in order to provide examples of more advanced usage. I have a few possibilities in mind:
Is there anything else that could be added to make this demo more useful?
https://github.com/rmosolgo/graphql-ruby-demo/blob/master/app/graph/queries/readLukesFriends.graphql
Running this query
query readLukesFriends {
luke: human(id: 1000) {
friends { name }
}
}
Returns
"Field 'name' doesn't exist on type 'CharacterConnection'"
But this query works:
luke: human(id: 1000) {
friends {
edges {
node {
name
}
}
}
}
This documentation is great: https://rmosolgo.github.io/graphql-ruby/relay/mutations but I'd love to see how mutations should be done by looking in this demo app.
Firstly, thank you so much for this repo, its been incredibly helpful to me. Thanks largely to this repo I've been able to get a batched GraphQL endpoint running over a rainy weekend ๐
One thing that I didn't understand, is the QuerySet
class legacy, or is it implicitly used somewhere? GH search doesn't show any references to it around the repo.
In addition, the files in app/graph/queries
don't appear to be referenced by anyone besides QuerySet
, so are these legacy too? I was under the impression that GraphQL provided a way to whitelist queries such that an internal API could not be abused to access unintended data, and wondered if it was related to this directory
For a quickstart demo helper, it would be helpful for me to see how to define a date type and use it in a schema
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.