Given the following graphical diagram of the apollo server, I wanted to split them into separate modules, so I donโt need the authorโs request in the root of the request .. and I want it to be divided. So I added another layer called authorQueries before adding it to Root Query
type Author { id: Int, firstName: String, lastName: String } type authorQueries { author(firstName: String, lastName: String): Author } type Query { authorQueries: authorQueries } schema { query: Query }
I tried the following: you can see that authorQueries was added as another layer before the author function is specified.
Query: { authorQueries :{ author (root, args) { return {} } } }
When querying in Graphiql, I also added an extra layer.
{ authorQueries { author(firstName: "Stephen") { id } } }
I get the following error.
"message": "Resolve function for \"Query.authorQueries\" returned undefined",
graphql apollo-server
elbarto
source share