Is the layer0 apollo middleware still needed?

The Layer0 graphql demo mentioned here: Layer0 Documentation - GraphQL does not rely on the @layer0/apollo package mentioned here: Layer0 Documentation - Prefetching

Is the @layer0/apollo package still needed?

The confusion is understandable. In general, we still recommend it if you need to prefetch GraphQL APIs, otherwise it is not needed.

  • For Layer0 GraphQL caching, the @layer0/apollo package is no longer needed on V4 and above. As V4, the you can directly cache GraphQL queries at the edge from your routes.js file without any additional packages as described in the GraphQL caching guide.
  • For Layer0 predictive prefetching of GraphQL, the package is still required. For a normal web link, the href attribute specifies the data that should be prefetched. However, when a link is fulfilled by a GraphQL query there isn’t a similar convention, so the developer still needs to use createApolloURL in @layer0/apollo to tell the platform the data that must be prefetched.