Sha256: 50852c6e7fbf1f2dec5b756dfd0adde2475f6a005cd396f417ad8c5693236019

Contents?: true

Size: 689 Bytes

Versions: 20

Compression:

Stored size: 689 Bytes

Contents

# frozen_string_literal: true

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

class FirstRemoteApp
  def call(env)
    req = Rack::Request.new(env)
    case req.path_info
    when /graphql/
      params = JSON.parse(req.body.read)
      result = Schemas::Example::Storefronts.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(FirstRemoteApp.new, :Port => 3001)

Version data entries

20 entries across 20 versions & 1 rubygems

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