I was following Flavio Copes' tutorial on creating a basic GraphQL server in Express the other day. The tutorial was good, but I realised at the end that it didn't give you an example of a query to actually see the resolvers in action.

Luckily I've picked up enough GraphQL to be able to write a simple query; just need to get the subscriptions sorted now!

The query below will return title and author name for all posts; then title and author for only post 0.

{
  posts {
    title
    author {
      name
    }
  },
  post(id: 0) {
    title
    author {
      name
    }
  }
}