Sha256: 65a17201e0351832d7bfd3cc3ced08b05f1f5633dfc40b491fcacfd2e93e21ad

Contents?: true

Size: 693 Bytes

Versions: 20

Compression:

Stored size: 693 Bytes

Contents

# frozen_string_literal: true

require 'rackup'
require 'json'
require 'graphql'
require_relative '../test/schemas/example'

class SecondRemoteApp
  def call(env)
    req = Rack::Request.new(env)
    case req.path_info
    when /graphql/
      params = JSON.parse(req.body.read)
      result = Schemas::Example::Manufacturers.execute(
        query: params["query"],
        variables: params["variables"],
        operation_name: params["operationName"],
      )
      [200, {"content-type" => "application/json"}, [JSON.generate(result)]]
    else
      [404, {"content-type" => "text/html"}, ["not found"]]
    end
  end
end

Rackup::Handler.default.run(SecondRemoteApp.new, :Port => 3002)

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
graphql-stitching-1.1.1 example/remote2.rb
graphql-stitching-1.1.0 example/remote2.rb
graphql-stitching-1.0.6 example/remote2.rb
graphql-stitching-1.0.5 example/remote2.rb
graphql-stitching-1.0.4 example/remote2.rb
graphql-stitching-1.0.3 example/remote2.rb
graphql-stitching-1.0.2 example/remote2.rb
graphql-stitching-1.0.1 example/remote2.rb
graphql-stitching-1.0.0 example/remote2.rb
graphql-stitching-0.3.6 example/remote2.rb
graphql-stitching-0.3.4 example/remote2.rb
graphql-stitching-0.3.3 example/remote2.rb
graphql-stitching-0.3.2 example/remote2.rb
graphql-stitching-0.3.1 example/remote2.rb
graphql-stitching-0.3.0 example/remote2.rb
graphql-stitching-0.2.3 example/remote2.rb
graphql-stitching-0.2.2 example/remote2.rb
graphql-stitching-0.2.1 example/remote2.rb
graphql-stitching-0.1.0 example/remote2.rb
graphql-stitching-0.0.1 example/remote2.rb