Method: GraphQLServer#initialize
- Defined in:
- lib/graphql_server.rb
#initialize(*args, type_def: nil, resolver: nil, schema: nil, context: nil) ⇒ GraphQLServer
Initilizes GraphQLServer as a Rack app or middleware
This Rack middleware (or app) implements a spec-compliant GraphQL server which can be queried from any GraphQL client. It can be used with a provided GraphQL schema or can build one from a type definition and a resolver hash.
19 20 21 22 23 |
# File 'lib/graphql_server.rb', line 19 def initialize(*args, type_def: nil, resolver: nil, schema: nil, context: nil) @app = args && args[0] @context = context @schema = type_def && resolver ? GraphQL::Schema.from_definition(type_def, default_resolve: resolver) : schema end |