Learning about the fundamentals of GraphQL
GraphQL APIs contain three important root types – query, mutation, and subscription. These are all defined in the GraphQL schema using special SDL syntax.
GraphQL provides a single endpoint that returns the JSON response based on the request, which can be a query, a mutation, or a subscription.
First, let's understand queries.
Exploring the Query type
The Query
type is used for reading operations that fetch information from the server. A single Query
type can contain many queries. Let's write a query using SDL to retrieve the logged-in user, as shown in the following GraphQL schema:
type Query {    me: LogginInUser   # You can add other queries here } type LoggedInUser {   id: ID   accessToken: String   refreshToken: String   username: String }
Here, you have done two things:
- You have defined the query root of the GraphQL interface,...