Suppose I have following type definition for my GraphQL API:
const typeDef = `
type Book {
title: String
author: Author
likes: Int
}
type Author {
id: String
name: String
age: Int
books: [Book]
}
type Query{
books(authorid: String!): Book
}
`
Then, how many resolvers do I need for this? Should I handle this query request with only one resolver books
and return all books and author info or should I make many resolvers such as Query -> books
, Book -> author
and Author -> books
? I am not sure how the modular schema and resolver works together.