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

新潟WEBアプリケーション勉強会 Vol.1 LT GraphQL Federation

新潟WEBアプリケーション勉強会 Vol.1 LT GraphQL Federation

yukikayuki

July 21, 2022
Tweet

More Decks by yukikayuki

Other Decks in Programming

Transcript

  1. 4DIFNB 2VFSZ 3FTQPOTF query { posts { id title }

    } { "data": { "posts": [ { "id": 1, "title": "title-1" }, { "id": 2, "title": "title-2" } ] } } 1045IUUQTFYBNQMFDPNHSBQIRM type Post { id: Int title: String content: String } type Query { post(id: Int): Post posts: [Post] } 4DIFNB 2VFSZ 3FTQPOTF
  2. 4VQFSHSBQI4DIFNBͷ࡞੒ type User @key(fields: "id") { id: Int! name: String!

    } type Query { user(id: Int): User users: [User] } type Post { id: Int title: String content: String user: User } type User @key(fields: "id") { id: Int! } type Query { post(id: Int): Post posts: [Post] } type Post @join__type(graph: USERS) { id: Int title: String content: String user: User } type Query @join__type(graph: POSTS) @join__type(graph: USERS) { user(id: Int): User @join__field(graph: POSTS) users: [User] @join__field(graph: POSTS) post(id: Int): Post @join__field(graph: USERS) posts: [Post] @join__field(graph: USERS) } type User @join__type(graph: POSTS, key: "id") @join__type(graph: USERS, key: "id") { id: Int! name: String! @join__field(graph: POSTS) } 4VQFSHSBQI4DIFNB 6TFS4DIFNB 1PTU4DIFNB 3PWFS$-*
  3. 2VFSZ 3FTQPOTF query { posts { title user { name

    } } } { "data": { "posts": [ { "title": "title-1", "user": { "name": "taro" } }, { "title": "title-2", "user": { "name": "jiro" } } ] } } 1045IUUQTFYBNQMFDPNHSBQIRM 2VFSZ 3FTQPOTF
  4. ಋೖ࣌ͷϙΠϯτ ͩͱߟ͍͑ͯΔͱ͜Ζ w TVQFSHSBQIHBUFXBZ͕ࢀর͢ΔTDIFNBࣗମͷ؅ཧ w ৗʹTVQFSHSBQITDIFNBΛߏ੒Մೳ͔Λݕࠪ͠ଓ͚Δඞཁ͕͋Δ w ΑΓεΩʔϚϑΝʔετͳ։ൃͷྲྀΕʹ w TVCHSBQIσϓϩΠޙʹTVQFSHSBQIHBUFXBZ͕ࢀর͢ΔTDIFNBͷߋ৽

    w HBUFXBZ͸(SBQI2-ΫΤϦΛཧղ͢Δݡ͍ࢠͳͷͰɺσϓϩΠʹΑͬͯ TVCHSBQIͰར༻Մೳͳঢ়ଶʹͳͬͯ΋ɺHBUFXBZ͕ࢀর͢ΔTDIFNB͕ TVCHSBQIͰར༻Մೳʹͳ߲ͬͨ໨Λ൓ө͍ͯ͠ͳ͍৔߹ɺΫϥΠΞϯτ͔Β͸࢖ ༻Ͱ͖ͳ͍