Developing GraphQL Queries Using marketplace-kit gui
This guide will help you quickly develop GraphQL queries using the
marketplace-kit gui serve command.
marketplace-kit gui serve command is very useful when:
You are developing a new query and you want to be sure it is working - it communicates with the database directly, so you are eliminating errors stemming from other layers and features of the system.
You are debugging an error - because you have direct control over a query and instant feedback after your changes, you can strip everything that you don't need, manipulate arguments passed, etc.
So that you can follow the steps in this tutorial, you have to have the Marketplace Kit installed, an environment configured, and the codebase set up. You should be familiar with Pages, and the technologies behind platformOS, especially Liquid.
- Quickstart Guide or Get Started tutorials: help you get access to our platform, set up a site, install the Marketplace Kit, set up the required directory structure, and deploy to your site.
Developing GraphQL queries using marketplace-kit gui is a two-step process:
Step 1: Start marketplace-kit gui serve
marketplace-kit gui serve staging Server is listening on 3333 Resources Editor: http://localhost:3333/gui/editor GraphQL Browser: http://localhost:3333/gui/graphql
stagingwith the environment name you want to develop on. To list all available environments use
marketplace-kit env list
Step 2: Write / update query
To write your query go to the second link: http://localhost:3333/gui/graphql
You will be greeted with graphiql editor.
- On the right side, you can open sidebar with graphql schema documentation.
- When you don't know what to type, try pressing
ctrl + space- this will open the suggestion box and usually help you decide.
- To quickly run the query, press
ctrl + enter(or
cmd + enteron a Mac).
- To pass arguments to a query, open
Query variablespanel on the bottom and write them in JSON format (see image above)