Sha256: d4d9bbd73ae02fdcd7c345b4c4ea006422a09854553939c0e7817629c35cfe19
Contents?: true
Size: 894 Bytes
Versions: 15
Compression:
Stored size: 894 Bytes
Contents
# frozen_string_literal: true require 'rackup' require 'json' require 'graphql' require_relative '../../lib/graphql/stitching' require_relative './helpers' class StitchedApp def initialize @client = GraphQL::Stitching::Client.new(locations: { gateway: { schema: GatewaySchema, }, remote: { schema: RemoteSchema, executable: GraphQL::Stitching::HttpExecutable.new( url: "http://localhost:3001", upload_types: ["Upload"] ), }, }) end def call(env) params = apollo_upload_server_middleware_params(env) result = @client.execute( query: params["query"], variables: params["variables"], operation_name: params["operationName"], ) [200, {"content-type" => "application/json"}, [JSON.generate(result)]] end end Rackup::Handler.default.run(StitchedApp.new, :Port => 3000)
Version data entries
15 entries across 15 versions & 1 rubygems