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)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay