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

GraphQL in #kbkz_tech

KOBA789
November 27, 2016

GraphQL in #kbkz_tech

歌舞伎座.tech #12 でLTした GraphQL に関するスライドです。
↓の方にあると思われる tng23 でやったスライドも見てね。

KOBA789

November 27, 2016
Tweet

More Decks by KOBA789

Other Decks in Programming

Transcript

  1. View Slide

  2. KOBA789
    ࠓ͸ஜ೾େֶͰB2 (ͦΖͦΖୀֶ)
    ࠷ۙ͸ΞΠΧπ͓͡͞Μͱͯ͠ੜ͖͍ͯ·͢
    ਺೥લʹGoͰProtocolBuffer΍ͬͯ·ͨ͠
    JavaScript͕ϝΠϯͰɺRuby΍Rust΋ॻ͘

    View Slide

  3. View Slide

  4. લఏ
    REST͸Ϋι
    LTͳͷͰओޠ͸େ͖Ί

    View Slide

  5. ࿩͍ͨ͜͠ͱ͸
    ͍Ζ͍Ζ͋Δ͕

    View Slide

  6. GraphQL

    View Slide

  7. GraphQL
    • ΫΤϦ+εΩʔϚͷ࢓༷
    • self-documentedͳεΩʔϚ(SwaggerūŬťƀ)
    • serialization format͸JSON
    • ݁ߏ͍͍ײ͡ͷܕγεςϜ(Unionͱ͔͋Δ)
    • Introspection API͕͋Δ
    • ެࣜͷAPIίϯιʔϧ

    View Slide

  8. {
    articles {
    author {
    name
    }
    }
    }
    {
    "articles": [
    {
    "author": {
    "name": "Alice"
    }
    },
    {
    "author": {
    "name": "Bob"
    }
    }
    ]
    }

    View Slide

  9. View Slide

  10. ݴޠػೳͰॻ͖͍ͨͷͰ

    View Slide

  11. ؾ࣋ͪ
    • ͔͔ͤͬͩ͘Βde-dupͱ͔΋΄͍͠
    • ݁ہϗετݴޠͰ͋ΔJSͷܕγεςϜ͕ऑ͍
    • σʔλιʔεʹSQL DBͱ͔Λ࢖͏ͱ

    N+1໰୊͕͠Εͬͱى͜Δ

    View Slide

  12. GraphQlͷະདྷͷ࿩
    • ετϦʔϛϯάͱ͔Ͱ͖ΔΑ͏ʹͳΔΒ͍͠
    • Server Pushͱ͔
    • https://www.youtube.com/watch?
    v=ViXL0YQnioU

    View Slide