Define Resolver for Object within Object

Author field in the Book object needs a self defined resolver to access the fields in Author object.

type Author {
name: String!
id: ID!
born: Int
bookCount: Int
}
type Book {
title: String!
published: Int!
author: Author!
id: ID!
genres: [String!]!
}
const resolvers = {
Query: {
// ...
},
Book: {
author: (root) => {
return {
name: root.author.name,
id: root.author.id,
born: root.author.born
}
}
}
}