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

GraphQLの話 (API for Front-end)

KOBA789
October 21, 2016

GraphQLの話 (API for Front-end)

tng23 でやったやつ

KOBA789

October 21, 2016
Tweet

More Decks by KOBA789

Other Decks in Programming

Transcript

  1. // ϒϩάهࣄ(id=1)Λऔಘ GET /articles/1 // ϒϩάهࣄ(id=1)ͷίϝϯτͷҰཡ GET /articles/1/comments // ϒϩάهࣄ(id=1)ΛίϝϯτҰཡͱචऀ෇͖Ͱ

    ͏ʔΜ…… GET /articles/1?embeds[]=comments&embeds[]=author // ͋ɺ΍ͬͺίϝϯτ͸಄ͷ3͚݅ͩͰ GET /articles/1?embeds[]=author GET /comments/?article_id=1&count=3
  2. // VM(id=1)Λγϟοτμ΢ϯ ͏ʔΜɺిݯ͸αϒϦιʔε͔ͳ…… DELETE /machines/1/power // VM(id=1)Λڧ੍γϟοτμ΢ϯ ΫΤϦύϥϝʔλ͔ͳ…… DELETE /machines/1/power?force=true

    // ిݯͷঢ়ଶΛऔಘ GET /machines/1/power ϨεϙϯεϘσΟͷ಺༰ͬͯͳΜͳΜͩΖ͏…… ΍ͬͺΓαϒϦιʔε͡Όͳͯ͘ଐੑͳͷ͔ͳ…… ଐੑͩͱͨ͠Βɺىಈɾऴྃ͸PATCH͔ͳ……
  3. 4FSWFS #BDLFOE M C V $MJFOU ͓޷͖ͳݴޠͰ 'SPOUFOE M C

    V JS΍ΒJSX΍Β ServerͷM͕SQLୟ͍ͨΓ͢ΔΑ͏ʹɺ
 ClientͷM΋APIΛୟ͘
  4. 4FSWFS #BDLFOE M C V $MJFOU ͓޷͖ͳݴޠͰ 'SPOUFOE Action JS΍ΒJSX΍Β

    ΋ͪΖΜMVC͡Όͳͯ͘΋Αͯ͘ɺ ͦΕͧΕద੾ʹઃܭ͠·͠ΐ͏ͱ͍͏͜ͱͰ͢ ActionCreator Dispatcher Store
  5. SELECT row_to_json("accounts") FROM ( SELECT * , ( SELECT array_agg(row_to_json("delegates"))

    FROM ( SELECT * , ( SELECT row_to_json("groups") FROM (SELECT * FROM "groups") AS "groups" WHERE ( "groups".id = "delegates"."group_id" )) AS "group" FROM "delegates") AS "delegates" WHERE ( "delegates"."account_id" = "accounts".id )) AS "delegates" FROM "accounts") AS "accounts" N+1໰୊