This post shows best practices π« of migrating APIs to GraphQL. Add your thoughts, collabore asking/resolving concerns π€, show them your folks, but ππ», share knowledge π
Lessons Learned
Modularize π your typeDefs & resolvers π
βBreak your schema by concern, not by typesββββMartijn Walraven π
DRY β»οΈ, use context! π
Evaluate whether your schema is feature or domain based π
Show whatβs important π first π
Decouple global typeDefs! π
Take advantage π of ESNext π
Return several types using Union Types!π
Use Aliases π₯ to rename the result of a field π
Donβt over-engineer, you can query with fetchπ
DRY β»οΈ, use fragments!
Get rid off your variables using Input Types π
Extra π
Donβt miss the 1st part of a series resuming PayPalβs best practices for building GraphQL APIs π
Recapping
π Modularize π **your typeDefs & resolvers
π βBreak your schema by concern, not by typesβ β Martijn Walraven
π DRY β»οΈ, use context!
π Evaluate whether your schema is feature or domain based
π Show whatβs **important π **first
π Decouple global typeDefs!
π Take advantage π of **ESNext
π Return several types using **Union Types!
π Use Aliases π₯ to rename the result of a field
π Donβt over-engineer, you can query with **fetch
π DRY β»οΈ, use fragments!
π Get rid off your variables using Input Types
βοΈ GraphQL Resolvers: Best Practices
Already waiting to add yours π€, contribute adding more lessons learned π
Or even betterβ¦
Create posts π, courses π, meetups π, anything!, just be π€ and curious for teaching & learning π
Iβll be following this post up π with more lessons learned, stay tuned!
Please, considerππ»ing, contributβ»οΈing and sharπing it!
Top comments (0)