Upgrade to Pro — share decks privately, control downloads, hide ads and more …

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

ryohysk
August 24, 2019

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

ryohysk

August 24, 2019
Tweet

Other Decks in Programming

Transcript

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

    GraphQLαʔόʔ Λ࡞ͬͯຯΘͬͨ ఱࠃͱ஍ࠈ גࣜձࣾϏσΦϚʔέοτ ૣࡔ ྋ Kotlin Fest 2019 2019/08/24
  2. www.companyname.com © 2016 Jetfabrik Multipurpose Theme. All Rights Reserved. 3

    GraphQLͱKotlinΛϓϩμΫτʹ࠾༻ͨ͠ཧ༝ ͸ͳ͢͜ͱ ఱࠃΈʢ3ͭʣ ஍ࠈΈʢ2ͭʣ
  3. 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. www.companyname.com © 2016 Jetfabrik Multipurpose Theme. All Rights Reserved. 7

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

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

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

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

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

    ⅱ) σʔλϩʔμʔʹϏδωεϩδοΫΛొ࿥͢Δ ஍ࠈΈ② - σʔλϩʔμʔ࣮૷खॱᾝ ʲࢀߟʳ
  10. www.companyname.com © 2016 Jetfabrik Multipurpose Theme. All Rights Reserved. 13

    ⅲ) ొ࿥ͨ͠σʔλϩʔμʔΛݺͼग़͢ ஍ࠈΈ② - σʔλϩʔμʔ࣮૷खॱᾞ ʲࢀߟʳ
  11. www.companyname.com © 2016 Jetfabrik Multipurpose Theme. All Rights Reserved. 14

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