I am simply following https://graphql-ruby.org/getting_started
This GraphQL engine is based on Rails. They have GraphQL schema defined with DSL.
rails g graphql:install
bundle install
Use command
rails g graphql:object Post title:String rating:Int comments:[Comment]
Or define them in app/graphql/types/
I am gonna follow https://www.howtographql.com/graphql-ruby/0-introduction/
- Create a model (resource), and migrate
- Add the type for the model
- Make a query type
- Build mutation for this type
- Change model
- Add new field in object type
- Run everything:
bundle exec rails test
- Run a file:
rails test <file_path>
- Run a test case by line number:
rails test <file_path>:<line_number>