import { ApolloClient, InMemoryCache, HttpLink } from '@apollo/client';
import { createPersistedQueryLink } from '@apollo/client/link/persisted-queries';
import { sha256 } from 'crypto-hash';
const linkChain = createPersistedQueryLink({ sha256 }).concat(
new HttpLink({ uri: 'http://localhost:4000/graphql' }),
);
const client = new ApolloClient({
cache: new InMemoryCache(),
link: linkChain,
});
Does this code work only for the apollo-server and standAloneServer or does this work with Fastify also, I mean the code surely is the client side implementation but in the docs it says the server side code remains the same. But here the hash for the query is generated but with the 400 status and in the response of the network tab I find a error saying “query string is required”. Where have I gone wrong? Surely the client side must handle the things right?
I want the hash to be validated and send the data if identified by the server and use the same from next time. Maybe I should add something in the server side?? Is that possible through some fastify plugin.
Rahul is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.