Exciting release!Introducing "safe npm". Learn more
Socket
Log inDemoInstall

@layer0/apollo

Package Overview
Dependencies
3
Maintainers
1
Versions
2440
Issues
File Explorer

Advanced tools

@layer0/apollo

Apollo GraphQL middleware for enabling edge caching on Layer0.

    4.19.8latest
    npm

Version published
Maintainers
1
Weekly downloads
1,787
increased by83.66%

Weekly downloads

Readme

Source

@layer0/apollo

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

Configuration

// 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 } }

Getting the URL to prefetch

import { createApolloURL } from '@layer0/apollo' const urlToPrefetch = createApolloURL(apolloClient, query, variables)

FAQs

Last updated on 06 Feb 2023

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.

Install Socket
Socket
support@socket.devSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc