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