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