Created
October 2, 2016 10:21
-
-
Save gauravtiwari/5227dc0c49e5d3ae02a96051470acb2f to your computer and use it in GitHub Desktop.
Initialise graphql client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module API | |
HTTPAdapter = GraphQL::Client::HTTP.new(ENV['API_URL']) | |
# | |
# Pass block to send auth token | |
# def headers(context) | |
# { | |
# "Authorization" => "Bearer #{ENV['ACCESS_TOKEN']}" | |
# } | |
# end | |
# | |
GraphQL::Client.dump_schema(HTTPAdapter, './api/schema.json') | |
Client = GraphQL::Client.new( | |
schema: GraphQL::Client.load_schema('./api/schema.json'), | |
execute: HTTPAdapter | |
) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment