Skip to content

Instantly share code, notes, and snippets.

@AlecAivazis
Last active March 7, 2019 10:20
Show Gist options
  • Save AlecAivazis/09f6a1a0ad9a5b2f3eb7ba486bf8c8f2 to your computer and use it in GitHub Desktop.
Save AlecAivazis/09f6a1a0ad9a5b2f3eb7ba486bf8c8f2 to your computer and use it in GitHub Desktop.
import { ApolloLink } from 'apollo-link'
import { Observable } from 'apollo-link-core'
import { graphql } from 'graphql'
import { print } from 'graphql/language/printer'
import schema from './schema'
const blockChainLink = new ApolloLink(
(operation) => new Observable(observer => {
graphql(schema, print(operation.query), null, null, operation.variables)
.then(result => {
observer.next(result)
observer.complete()
})
})
)
// ... everything else...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment