Created
May 10, 2018 14:27
-
-
Save gc-codesnippets/69750a632a43195719c0dc9457f1f1b1 to your computer and use it in GitHub Desktop.
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
const fs = require('fs') | |
const path = require('path') | |
const fetch = require('node-fetch') | |
const { Binding } = require('graphql-binding') | |
const { HttpLink } = require('apollo-link-http') | |
const { makeRemoteExecutableSchema } = require('graphql-tools') | |
const link = new HttpLink({ uri: 'https://post-service-nyvvyjtbyt.now.sh', fetch }) | |
const typeDefs = fs.readFileSync( | |
path.join(__dirname, '../schemas/post-service.graphql'), | |
'utf-8', | |
) | |
const schema = makeRemoteExecutableSchema({ link, schema: typeDefs }) | |
class PostBinding extends Binding { | |
constructor() { | |
super({ schema }) | |
} | |
} | |
module.exports = PostBinding |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment