Luke
@perpetual_dev
@perpetual_dev
How are we organizing resolvers in backend graphQL? Right now I have a monster file called schema.js that is full of different types of Queries and mutations.
const resolvers = { Query: { getUserByID: async (parent, args, contextValue) => { if (!contextValue.user) return; return simpleResolver( contextValue.pool, 'SELECT * FROM "user" WHERE id = $1;', [contextValue.user.userId] ); }, }}
I havent used graphql for a while mainly due to the amount of overhead of setting up a graphql server vs just using rest. But there are a few good articles that describe best practices for organizing resolvers.
This one is from apollo and seems p good: https://www.apollographql.com/blog/backend/schema-design/modularizing-your-graphql-schema-code/