git clone git@github.com:Aristat/rails-graphql-example-app.git bin/rails db:create bin/rails db:migrate bin/rails db:seed bundle exec rails s -p 3000 localhost:3000/graphql Code structure
. ├── fixtures // fixtures for specs ├── db // migrations and seeds for DB └── app ├── graphql // graphql logic └── controllers/graphql_controller // graphql action with jwt auth Generate token for auth
bin/rails c JWTWrapper.generate_user_token(User.last) this token set in headers -
{ "Authorization": "bearer example_token_from_console" } query userProfile { userProfile { id name } } mutation updateUser($userInput: UserInput) { updateUser(userInput: $userInput) { ok errors { message type } } } query productBlock($productId: ID!) { product(id: $productId) { name typeObject itemsCount productItems { nodes { color price } } } } RAILS_ENV=test rspec spec/ https://github.com/prisma/graphql-playground - for easy query writing