@edgio/apollo

7.5.0 • Public • Published

@edgio/apollo

Allows you derive the URL for apollo queries so you can prefetch them using @edgio/prefetch

Configuration

// apollo client configuration
import { createHttpLink } from '@edgio/apollo'

export default () => ({
  defaultHttpLink: false,
  link: createHttpLink({
    uri: typeof window === 'undefined' ? process.env.SHOPIFY_GQL_ENDPOINT : '/api/graphql',
    headers: { 'Access-Token': process.env.GQL_ACCESS_TOKEN },
  }),
})

If you're using @nuxtjs/apollo, you can use the configuration above by linking it to the apollo config in your nuxt.config.js:

  apollo: {
    clientConfigs: {
      default: '~/apollo.config.js' // path to the apollo client config shown above
    }
  }

Getting the URL to prefetch

import { createApolloURL } from '@edgio/apollo'

const urlToPrefetch = createApolloURL(apolloClient, query, variables)

Readme

Keywords

none

Package Sidebar

Install

npm i @edgio/apollo

Weekly Downloads

2

Version

7.5.0

License

Apache-2.0

Unpacked Size

17.8 kB

Total Files

16

Last publish

Collaborators

  • moovweb-admin