- Clone the repo
gh repo clone heeyunlee/graphql-rest-api-comparison
-
Get WordPress website
-
Install WPGraphQL plugin to your website
-
Change
baseUrl
andquery
variables to your likings
For example, if you want to fetch the title
, date
, excerpt
, and authorName
of the posts from your website, you could change variables to something like this:
const baseUrl = 'www.yourname.com';
const String query = r'''
query Posts($first: Int!) {
posts(first: $first) {
nodes {
title
date
excerpt
author {
name
}
}
}
}
''';
Use the tools you like (Postman or Insomnia) to find the Schemas for your query
Example: