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

GraphQLのステキポイントと悩ましいポイント

maru333
October 09, 2019

 GraphQLのステキポイントと悩ましいポイント

maru333

October 09, 2019
Tweet

Other Decks in Programming

Transcript

  1. P R E S E N T A T I

    O N B Y @ m a r u 3 3 3 GraphQLͷεςΩϙΠϯτͱ ೰·͍͠ϙΠϯτ
  2. εςΩ̎ ResponseCode͕200 OK ΫϥΠΞϯτ A Server ʢओཁʣ B Server ʢαϒʣ

    GraphQL Server ཁٻ ཁٻ OK ཁٻ NG OK Ұ෦੒ޭͷσʔλΛॲཧͰ͖Δ
  3. GraphQL Server ೰·͍̍͠ ઃܭ͕ΫϥΠΞϯτͱີʹ Ϣʔβ৘ใ χϡʔε ͦͷଞ αʔϏε HOMEͷ৘ใ͘Ε HOME

    query HomeInfo() ͦͷଞ αʔϏε HOMEͷ৘ใͩΑ ϙΠϯτ৘ใ Ϣʔβ৘ใ ;Ή;Ή HOMEͷ ৘ใͩͳ
  4. - extensions ͷத਎͸༷ʑ - ޷͖উखʹ৭ʑೖͬͯ͠·͏ - εΩʔϚͰఆٛͰ͖ͳ͍ - ΧΦε ೰·͍̏͠

    Τϥʔύλʔϯʹղͳ͠ https://www.apollographql.com/docs/apollo-server/data/errors/ - errors object ʹΤϥʔ͕ೖΔ - extensions ʹ޷͖ʹ͍ΕͯͶʂ
  5. ݕ౼̍ HTTP Error Status ʹدͤΔ graphql-java Ͱ͜ΕΛ΍Ζ͏ͱ͢Δͱɺ ͔ͳΓτϦοΩʔͳ࣮૷ʹͳΔˍকདྷʹ౉ͬͯอূͰ͖ͳ͍ ฐࣾCTOஊɿ nginx

    ͱ͔Ͱ HTTP Error ͸Ͳ͏ͤ ൃੜ͢Δ͔Βɺ(ΫϥΠΞϯτͰ ίϯτϩʔϧ͢Δඞཁͷͳ͍΋ͷ͸) GraphQLͷΤϥʔ΋HTTP Error ʹ دͤΔͱ͍͏ͷ͸Ͳ͏͔ʁ → ҰಉɿͳΔ΄Ͳɺ͔֬ʹʂʂʂ
  6. ݕ౼̎ ΤϥʔΫϥεͷఆٛ UserError Unauthorized Error Validation Error query { me

    { … on DataResult {} … on UserError { } } } ͨͩ͠ɺerrorsύλʔϯ΋࢒ΔˍHTTP Error ΋ൃੜ͢ΔͨΊɺ ΤϥʔϋϯυϦϯά͸গ͠ෳࡶʹͳΓͦ͏
  7. Vector Icons by Matthew Skiles Presentation template designed by Slidesmash

    Photographs by pexels.com Special thanks to all people who made and share these awesome resources for free: Credits
  8. This presentation uses the following typographies and colors: Colors used

    Free Fonts used: https://www.fontsquirrel.com/fonts/League-Gothic https://www.fontsquirrel.com/fonts/open-sans Presentation Design