✨Graphql schema
GraphQL schema is like a blueprint for your data. It defines how your data is structured and how you can interact with it. The schema outlines the types of data available, relationships between them, and the operations (queries and mutations) you can perform.
Main Operations In graphql
query GetUserDetails($userId: ID!) {
user(id: $userId) {
id
name
email
}
}mutation UpdatePost($postId: ID!, $input: PostInput!) {
updatePost(id: $postId, input: $input) {
id
title
content
}
}- subscriptions in graphql
[They act like web sockets]
Purpose: Used to receive real-time updates when data on the server changes.
What it Does: Establishes a long-lived connection to the server, allowing the server to push updates to the client when relevant data changes.
Example: Subscribing to receive notifications about new messages in a chat application.
subscription NewMessageNotification($chatRoomId: ID!) {
newMessage(chatRoomId: $chatRoomId) {
id
sender {
id
username
}
content
}
}Last updated