How to use Persisted Queries with React Relay and Apollo Server

228 Views Asked by At

My company is currently using React Relay Modern for the client side and Apollo Sever for our GQL server. As of now they are looking at adding a number of optimizations to improved performance. One of the things in my reading of the subject is the user of persisted queries. React Relay has a simple configuration for generating the md5 hash for the persisted queries along with a file that has the original query. However, Apollo Server has its own solution intended to work with Apollo Client. I can't find anything on any ways to marry these two concepts together. Apollo Server appears to be very rigid in how it wants to handle persisted queries which is making my task very difficult.

Anyone with any ideas or solutions that do not involved changing the underlying technologies would be greatly appreciated. So far the only thing I can think of is to install express JS middleware in front of Apollo Server and try to modify the hash back into the desired query object.

0

There are 0 best solutions below