class Graphql::Generators::InitGenerator

Public Instance Methods

add_gems() click to toggle source
# File lib/generators/graphql/init_generator.rb, line 6
def add_gems
  gem 'graphql'        
  gem 'graphiql-rails'
  gem 'graphql-formatter'
end
autoload_paths() click to toggle source
# File lib/generators/graphql/init_generator.rb, line 17
      def autoload_paths
        application do <<-'RUBY'
  config.autoload_paths += Dir["#{config.root}/app/graphql/**/"]
        RUBY
        end
      end
copy_templates() click to toggle source
# File lib/generators/graphql/init_generator.rb, line 24
def copy_templates
  copy_file 'controllers/graph_ql_controller.rb', 'app/controllers/graph_ql_controller.rb'
  copy_file 'models/root_level.rb', 'app/models/root_level.rb'
  copy_file 'graph/relay_schema.rb', 'app/graphql/relay_schema.rb'
  copy_file 'graph/node_identification.rb', 'app/graphql/node_identification.rb'
  copy_file 'graph/types/root_level_type.rb', 'app/graphql/types/root_level_type.rb'
  copy_file 'graph/types/query_type.rb', 'app/graphql/types/query_type.rb'
  copy_file 'graph/types/mutation_type.rb', 'app/graphql/types/mutation_type.rb'

  copy_file 'config/graphiql.rb', 'config/initializers/graphiql.rb'
end
routes() click to toggle source
# File lib/generators/graphql/init_generator.rb, line 12
def routes
  route "post 'graphql' => 'graph_ql#execute'"
  route "mount GraphiQL::Rails::Engine, at: '/graphiql', graphql_path: '/graphql'"
end