GraphQLサーバーを作って味わった天国と地獄

14db998b47be4e3c3962b03b7c16d195?s=47 ryohysk
August 24, 2019

 GraphQLサーバーを作って味わった天国と地獄

14db998b47be4e3c3962b03b7c16d195?s=128

ryohysk

August 24, 2019
Tweet

Transcript

  1. 1.

    www.companyname.com © 2016 Jetfabrik Multipurpose Theme. All Rights Reserved. 1

    GraphQLαʔόʔ Λ࡞ͬͯຯΘͬͨ ఱࠃͱ஍ࠈ גࣜձࣾϏσΦϚʔέοτ ૣࡔ ྋ Kotlin Fest 2019 2019/08/24
  2. 3.

    www.companyname.com © 2016 Jetfabrik Multipurpose Theme. All Rights Reserved. 3

    GraphQLͱKotlinΛϓϩμΫτʹ࠾༻ͨ͠ཧ༝ ͸ͳ͢͜ͱ ఱࠃΈʢ3ͭʣ ஍ࠈΈʢ2ͭʣ
  3. 5.

    www.companyname.com © 2016 Jetfabrik Multipurpose Theme. All Rights Reserved. 5

    ࢼ͠ʹΫΤϦΛ౤͛ͯΈ͍ͨ৔ ߹ʹ͍͍ͪͪॻ͘ͷ͸໘౗ɻ ADD QUERY΍ADD FRAGMENT Ͱߴ଎ʹΫΤϦΛ࡞੒Ͱ͖Δɻ ⅰ) ΫΤϦͷࣗಈੜ੒͕Ͱ͖Δ LightɺDarkɺDraculaͷࡾͭͷ ςʔϚ͔Β޷͖ͳςʔϚΛઃఆ ͯ͠࢖͏͜ͱ͕Ͱ͖Δɻ ⅱ) ΧελϜςʔϚ͕ઃఆͰ͖Δ Mac΍WindowsΞϓϦɺChrome΍Firefoxͷ֦ுػೳ΋ఏڙ͍ͯ͠ΔAltair(ΞϧλΠϧ)ɻ https:/ /altair.sirmuel.design/ Altair(GraphQL ΫϥΠΞϯτ)͕༏ल ఱࠃΈ①
  4. 7.

    www.companyname.com © 2016 Jetfabrik Multipurpose Theme. All Rights Reserved. 7

    ϑΟʔϧυʹΞΫηε͚ͨ࣌ͩ͠औಘ ॲཧ͕૸ΔΑ͏ʹͰ͖Δɻ ϚΠΫϩαʔϏεͱ૬ੑ͕͍͍ɻ graphql-spring-bootͷϥΠϒϥϦΛ࢖ ͏ͱɺGraphQLResolverΛ࢖͏͚ͩͰ ؆୯ʹ࣮૷Ͱ͖Δɻ ແବͳ௨৴Λ૸Βͤͳ͍ ఱࠃΈ② ྫ ϙΠϯτऔಘॲཧ͕ ૸Δ ϙΠϯτऔಘॲཧ͕ ૸Βͳ͍
  5. 8.

    www.companyname.com © 2016 Jetfabrik Multipurpose Theme. All Rights Reserved. 8

    GraphQLΛ࢖ͬͯΈ͍ͨਓ͕݁ߏ͍ͨɻ ΫΤϦͷֶशίετ΋௿͘ɺAltairͷ࢖༻ײ΋޷ධɻ ΞϓϦΤϯδχΞ΍σβΠφʔ͔ΒϞςΔ ఱࠃΈ③
  6. 9.

    www.companyname.com © 2016 Jetfabrik Multipurpose Theme. All Rights Reserved. 9

    εΩʔϚϑΝΠϧҎ֎ͰAPIͷఆٛΛͯ͠͠·͏ͱɺυΩϡϝϯτͷೋॏ؅ཧʹͳͬͯ ͠·͏ɻ GraphQLͰ͸ଞͷυΩϡϝϯτπʔϧͰ؅ཧ͠Α͏ͱ͠ͳ͍͜ͱɻ ΞϓϦΤϯδχΞ͕࢖͑ΔMockαʔόʔ͸ૣΊʹ༻ҙ͠Α͏ɻ ࢓༷ͱ࣮૷͕ζϨͨʂʁʢΞϯνύλʔϯʣ ஍ࠈΈ①
  7. 10.

    www.companyname.com © 2016 Jetfabrik Multipurpose Theme. All Rights Reserved. 10

    ఱ ࠃ Έ ② Ͱ औ Γ ্ ͛ ͨ Α ͏ ͳ GraphQLResolverΛ࢖࣮ͬͨ૷Λ҆қ ʹͯ͠͠·͏ͱɺϨεϙϯεʹͦͷϑ Οʔϧυ͕ෳ਺ग़ݱ͢Δ͚ͩͰN+1ͷ ௨৴͕ൃੜͯ͠͠·͏ɻ σʔλϩʔμʔΛ࢖͓͏ɻ N+1໰୊ͷରॲ ஍ࠈΈ② ྫ ϦΫΤετ ෳ਺ͷϢʔβʔΛऔಘ Ϩεϙϯε ϙΠϯτͷ਺͚ͩ௨৴ ௨৴ ௨৴ ௨৴ ௨৴
  8. 11.

    www.companyname.com © 2016 Jetfabrik Multipurpose Theme. All Rights Reserved. 11

    ⅰ) ·ͱΊͯऔಘͰ͖ΔϏδωεϩδοΫΛ࡞੒͢Δ(όϧΫϑΣον) ஍ࠈΈ② - σʔλϩʔμʔ࣮૷खॱᾜ ʲࢀߟʳ
  9. 12.

    www.companyname.com © 2016 Jetfabrik Multipurpose Theme. All Rights Reserved. 12

    ⅱ) σʔλϩʔμʔʹϏδωεϩδοΫΛొ࿥͢Δ ஍ࠈΈ② - σʔλϩʔμʔ࣮૷खॱᾝ ʲࢀߟʳ
  10. 13.

    www.companyname.com © 2016 Jetfabrik Multipurpose Theme. All Rights Reserved. 13

    ⅲ) ొ࿥ͨ͠σʔλϩʔμʔΛݺͼग़͢ ஍ࠈΈ② - σʔλϩʔμʔ࣮૷खॱᾞ ʲࢀߟʳ
  11. 14.

    www.companyname.com © 2016 Jetfabrik Multipurpose Theme. All Rights Reserved. 14

    ·ͱΊ 9݄ʹiOSΞϓϦϦχϡʔΞϧ༧ఆ https:/ /creators.videomarket.co.jp/ ΫϦΤΠλʔζϒϩά ɾϥΠϒϥϦΛ࢖͑͹͙͢ʹ։ൃ͕Ͱ͖Δ ɾGraphQLαʔόʔΛ࡞Δͱت͹ΕΔ ɾN+1͸ཁ஫ҙ