/graphql-demo

GraphqlDemo

Primary LanguageRuby

1.rails new graphql-demo 2. cd graphql-demo 3. git init 4. git commit -m 'Initial commit' 5. git add . 6. git commit -m 'Initial commit' 7. touch .ruby-gemset 8. bundle install 9. rails generate graphql:install 10. git add . 11. git commit -m 'GraphQL base setup'

Model Generation

  1. rails g model user id:integer first_name:string last_name:string email:string
  2. rails g model post id:integer user_id:integer content:text
  3. rails db:migrate
  4. git add .
  5. git commit -m 'User and Post model/migration'
  1. rails g graphql:object -h
  2. rails g graphql:object User
  • Create some user data
  • start rails server and navigate to http://localhost:3000/graphiql
  • Create some seed data
  1. rails g graphql:input -h
  2. rails g graphql:input User
  3. rails g graphql:mutation_create User
  4. rails g graphql:mutation_update User
  5. rails g graphql:mutation_delete User