The first step is to create the mapping from our graphql queries to their ids. To do this we
will use the
persistgraphql npm package.
persistgraphql expects that you store your
.graphql files in your source. If you aren't already doing this, the first step
is to move your queries out to their own
.graphql files and then
import those queries from your
Once you have your queries separated out into their own files then run these commands:
npm install -g persistgraphql
persistgraphql < projectdir >
This will generate an
extracted_queries.jsonfile that you will upload to Scaphold.
You can also point
persistgraphql to a single
.graphql file. Pointing it to a directory will
recursively pull queries out of every
Upload Your Queries to Scaphold¶
extracted_queries.json file to Scaphold is easy. Go to the GraphiQL tab in your
Scaphold portal and click Persisted Queries in the page header. This
will open a side panel where you can drop your
We will automatically store this mapping so our servers know what query to call for a
particular query id.