Skip to content

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring GraphQL Sandbox

Study project creating a GraphQL API with Spring Boot.

Pagination

GraphQL has a special — and native — Pagination model. The Relay/Cursor Pattern is usually useful for infinite scroll features and for paginating data with constant updates.

GraphQL Pagination

GraphQL Request

Schema

» File

type Query {
  authors: [Author]
  authorById(id: ID!): Author
  pagedAuthors(first: Int, after: String): AuthorConnection!
  books: [Book]
  bookById(id: ID!): Book
}

type Author {
  id: ID!
  name: String!
  bio: String
  books: [Book]
}

type Book {
  id: ID!
  title: String!
  description: String
  author: Author
}

type AuthorConnection {
  edges: [AuthorEdge!]!
  pageInfo: PageInfo!
}

type AuthorEdge {
  cursor: String!
  node: Author!
}

type PageInfo {
  hasPreviousPage: Boolean!
  hasNextPage: Boolean!
  startCursor: String
  endCursor: String
}

type Mutation {
  createBook(book: BookInput!): Book
} 

input BookInput {
  title: String!
  description: String
  authorId: ID!
}

About

Learning GraphQL With Spring Boot

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages