DEV Community

Paul Walker
Paul Walker

Posted on • Originally published at solarwinter.net on

GraphQL - first steps

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
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)