Great Article!
I noticed that using post.getAuthor() and post.getComments() we tell graphql to query database for all the posts one by one.
And I know this is only a template, but one wouldn't want to have as many queries to their DB. So I used sequelize' include model operation and then simply just returned post.author and post.comments. Of course this also comes at a cost of joining tables but sql table joins are better than multiple DB calls. Hope this would help someone.
Also, I would create a PR if you want :)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Great Article!
I noticed that using
post.getAuthor()
andpost.getComments()
we tell graphql to query database for all the posts one by one.And I know this is only a template, but one wouldn't want to have as many queries to their DB. So I used sequelize'
include
model operation and then simply just returnedpost.author
andpost.comments
. Of course this also comes at a cost of joining tables but sql table joins are better than multiple DB calls. Hope this would help someone.Also, I would create a PR if you want :)