heeyunlee / graphql-rest-api-comparison

Comparison of GraphQL and REST Api using WordPress API and WPGraphQL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Comparison of GraphQL and REST API using WordPress API and WPGraphQL

  1. Clone the repo

gh repo clone heeyunlee/graphql-rest-api-comparison

  1. Get WordPress website

  2. Install WPGraphQL plugin to your website

  3. Change baseUrl and query 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:

Screen.Recording.2022-07-02.at.6.23.06.PM.mov

About

Comparison of GraphQL and REST Api using WordPress API and WPGraphQL


Languages

Language:C++ 32.9%Language:CMake 28.5%Language:Dart 16.7%Language:Jupyter Notebook 10.1%Language:Ruby 4.2%Language:HTML 2.9%Language:C 2.2%Language:Swift 2.0%Language:Kotlin 0.2%Language:Python 0.1%Language:Objective-C 0.1%