Skip to content

Instantly share code, notes, and snippets.

@SurbhiKatariya
Last active April 9, 2020 08:07
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 SurbhiKatariya/6581b01ab0eaf136cd6fedaf26db289d to your computer and use it in GitHub Desktop.
Save SurbhiKatariya/6581b01ab0eaf136cd6fedaf26db289d to your computer and use it in GitHub Desktop.
Create custom link
const httpLink = new HttpLink({
uri: 'https://api.graph.cool/simple/v1/ciyz901en4j590185wkmexyex'
})
// set authorization header to authenticate the request using apollo link, it is optional.
/*
const authMiddleware = new ApolloLink((operation, forward) => {
const token = 'cllHNFlaZkpXbg64Qzh0Z3VJT2FOdz09'
operation.setContext({
headers: {
authorization: `Bearer ${token}`
}
})
return forward(operation)
})
*/
const link = ApolloLink.from([
// authMiddleware,
httpLink
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment