@layer0/apollo
Advanced tools
Apollo GraphQL middleware for enabling edge caching on Layer0.
Weekly downloads
Readme
Allows you derive the URL for apollo queries so you can prefetch them using @layer0/prefetch
// apollo client configuration
import { createHttpLink } from '@layer0/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
}
}
import { createApolloURL } from '@layer0/apollo'
const urlToPrefetch = createApolloURL(apolloClient, query, variables)
FAQs
Apollo GraphQL middleware for enabling edge caching on Layer0.
The npm package @layer0/apollo receives a total of 1,647 weekly downloads. As such, @layer0/apollo popularity was classified as popular.
We found that @layer0/apollo demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.