Human-Connection/Nitro-Documentation

Backend - GraphQL with Apollo - getting started queries for the playground

Closed this issue · 4 comments

(See backend issue #144: have documentation include getting started queries for the playground

Copy and paste from there.)

Arriving in the playground it's not immediately obvious what queries one can make.
68747470733a2f2f646c2e64726f70626f782e636f6d2f732f376c7231656d6f6135336a36357a762f53637265656e73686f74253230323031392d30322d303425323031332e31332e33312e706e673f646c3d30
Would be great if examples were included, either in the docs or when the playground starts up (maybe it does once it is seeded?) - There is something on this page in the docs:

https://docs.human-connection.org/nitro/backend/graphql-with-apollo

but would be great if there was something to copy and paste, or even something that just pops out when things start (apologies if there is already something like this after seeding)

@appinteractive :
There is a possibility in the latest GraphQL-Yoga Server to add predefined queries in the playground. That would be a good solution I think.

@roschaefer :
We should include images in the documentation. @tansaku e.g. if you click on the green "Schema" bookmark on the right side, that will give you an overview of the possibilities. Also, you can Ctrl+Space to get auto-completion in the query editor on the left side.

E.g. type in {, hit enter. Curly braces will be auto-closed. Hit Ctrl+Space and you get a dropdown of all the resources. The response of the server is also quite helpful, e.g. you have to request at least one attribute etc.

@tansaku :
That's good to know Robert - we could also provide some simple text queries like:

{
  Post {
    title
  }
}

to help folks get started ...

@roschaefer :
@tansaku I would say that is calling for a PR to our documentation including a screenshot and a query for copy+paste 👍

There is a defaultPlaygroundQuery config key on our server which can include a starting query! See https://github.com/prisma/graphql-yoga/blob/master/README.md

Maybe this one would be a good starting point

{
  statistics {
    countUsers
    countPosts
    countComments
    countNotifications
    countOrganizations
    countProjects
    countInvites
    countFollows
    countShouts
  }
}