Twitter | Search | |
Carlos Rufo
Lessons Learned Migrating APIs to πŸ“ ↳ Share yours πŸ’œ ↳ Open πŸ—£ ↳ Be πŸ€— β € 🀠 [Thread] πŸ‘‡πŸ½ πŸ‘‡πŸ½ πŸ‘‡πŸ½ πŸ‘‡ πŸ‘‡πŸ½πŸ‘‡πŸ½ πŸ‘‡ πŸ‘‡πŸ½γ€€πŸ‘‡πŸ½ γ€€πŸ‘‡πŸ½γ€€ πŸ‘‡πŸ½ γ€€ πŸ‘’ πŸ‘’
Reply Retweet Like More
Carlos Rufo 26 Nov 18
Replying to @swcarlosrj
Create different files per each typeDefs & resolvers domain, then import and properly merge them. As you schema grows, you'll 😍 to have a modular design!
Reply Retweet Like
Carlos Rufo 26 Nov 18
"Break your schema by concern, not by types" by . Extend your typeDefs as much you can, it'll allow you to define clearly your typeDefs & ♻️ the logic functions within their respective resolvers πŸ‘Œ
Reply Retweet Like
Carlos Rufo 27 Nov 18
Replying to @JakeDawkins
You'd πŸ˜„ to be able to have access to certain methods inside of your resolvers right?, that's why πŸ‘‰ context πŸ‘ˆ exits. It is useful for passing things, like authentication scope, DB connections, and custom fetch functions. Thanks to for the tip πŸ€—
Reply Retweet Like
Carlos Rufo 28 Nov 18
Replying to @swcarlosrj
Structure your modular schema depending on your features, having only typeDefs & resolvers, you'd 😍 to structure it by feature, although if the number of features grow, do it by domain!
Reply Retweet Like
Carlos Rufo 28 Nov 18
Replying to @swcarlosrj
On large schemas you'll notice that each domain contains tons of types, prioritize πŸ‘‰ WHAT MATTERS FIRST. Knowing that the 'extends' keyword stands for links between types, put them to the πŸ” of the file, then add the domain type and finally the field types
Reply Retweet Like
Carlos Rufo 30 Nov 18
Replying to @swcarlosrj
Scalars, interfaces, enums, inputs… 😱, you'll have β™Ύ global typeDefs inside of your schema, don't miss the opportunity of identifying & decoupling them when you're creating your schema structure
Reply Retweet Like
Carlos Rufo 1 Dec 18
Replying to @swcarlosrj
Use async/await to fetch data from the DB/API, array destructuring to get individual elements and object destructuring to join/remove elements. ⚠️ Don't forget handle possible errors!
Reply Retweet Like
Victor Zamfir 7 Dec 18
Replying to @swcarlosrj
User resolver decorators to decouple validation / side effects from actual resolver's logic -
Reply Retweet Like
Carlos Rufo 7 Dec 18
Replying to @victorzamfir
Adding a visual example would help for understanding, I'd be delighted to add them to the post πŸ˜‰
Reply Retweet Like
Victor Zamfir 7 Dec 18
Replying to @swcarlosrj
One resolver per file properly structured to be able to find them on fuzzy search - BlogCategory/posts, Query/allBlogPosts etc
Reply Retweet Like