Skip to content

Instantly share code, notes, and snippets.

@gc-codesnippets
Created May 10, 2018 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gc-codesnippets/69750a632a43195719c0dc9457f1f1b1 to your computer and use it in GitHub Desktop.
Save gc-codesnippets/69750a632a43195719c0dc9457f1f1b1 to your computer and use it in GitHub Desktop.
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