Save 37% off PRO during our Black Friday Sale! »

GraphQLで使うデータに TypeScriptで型を定義する

8f7edf2e42d87e1312fe6b646ced2cbc?s=47 kamiyam
September 06, 2019
310

GraphQLで使うデータに TypeScriptで型を定義する

kansai.ts#2
#kansaits

8f7edf2e42d87e1312fe6b646ced2cbc?s=128

kamiyam

September 06, 2019
Tweet

Transcript

  1. (SBQI2-Ͱ࢖͏σʔλʹ 5ZQF4DSJQUͰܕΛఆٛ͢Δ kansai.ts #2 2019.9.6 @kamiyam

  2. ࣗݾ঺հ ͔Έ΍Μ (Twitter@kamiyam) ݩࣗಈं੔උ࢜ METEORWORKS Inc. Engineer Node.js ϑϩϯτʙ όοΫΤϯυશൠ

  3. ࠓ೔͠ͳ͍࿩ GraphQLͷৄ͍͠࿩ αʔόʔଆ(schema.json)ͷ࿩

  4. IUUQTHSBQIRMPSH

  5. rLBNJZBN lΤϯυϙΠϯτʹରͯ͠σʔλͷߏ଄Λؾʹͤͣɺ 2VFSZͰඞཁͳσʔλ͚ͩϦΫΤετ͠ड͚औΔz

  6. IUUQTEFWFMPQFSHJUIVCDPNW

  7. Query͕ॊೈΏ͑ʹϨεϙϯεͷܕΛఆٛ͢Δͷ͕೉͍͠ʁ

  8. GraphQLͷܕఆٛΛར༻ͯ͠TSͷܕఆٛΛੜ੒͢Δ

  9. IUUQTXXXBQPMMPHSBQIRMDPN

  10. IUUQTXXXBQPMMPHSBQIRMDPNEPDTSFBDUSFDJQFTTUBUJDUZQJOH

  11. Apollo CLI(apollo-tooling)Λ࢖͏

  12. BQPMMPDMJFOUEPXOMPBETDIFNB TDIFNBKTPO ΤϯυϙΠϯτશମͷܕఆٛ Λੜ੒ IUUQTHJUIVCDPNBQPMMPHSBQIRMBQPMMPUPPMJOHBQPMMPDMJFOUEPXOMPBETDIFNBPVUQVU

  13. BQPMMPDMJFOUDPEFHFO 2VFSZɺ.VUBUJPOͷ݁ՌΛܕఆٛͨ͠JOUFSGBDFͷੜ੒ IUUQTHJUIVCDPNBQPMMPHSBQIRMBQPMMPUPPMJOHBQPMMPDMJFOUDPEFHFOPVUQVU

  14. %&.0

  15. Tips. QueryɺMutationʹ͸UNIQUEͳ໊લΛ෇͚Δ ܕ໊͕௕͘ͳΔͨΊ(Query/Mutation)໊͸୹Ί(?)ʹ
 (Ϩεϙϯεͷ݁Ռ͕ଟ֊૚ʹͳΔͱಛʹͦͷ܏޲)

  16. Refs. Using Apollo with TypeScript
 https://www.apollographql.com/docs/react/recipes/static-typing/ Configuring Apollo projects
 Option

    2: Link a schema from a remote endpoint
 https://www.apollographql.com/docs/references/apollo-config/#option-2-link-a-schema-from-a-remote-endpoint An Introduction to GraphQL via the GitHub API
 https://blog.codeship.com/an-introduction-to-graphql-via-the-github-api/
  17. ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠