Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
GraphQL on Scala
Search
petitviolet
June 28, 2018
Programming
3
2.6k
GraphQL on Scala
Introduction for GraphQL and implementing GraphQL API using Scala.
petitviolet
June 28, 2018
Tweet
Share
More Decks by petitviolet
See All by petitviolet
Stripeで請求書払い&銀行振込を実装する
petitviolet
0
1.2k
ピュアなドメインを支える技術/pure domain model and the technology behind it
petitviolet
14
9.8k
小さく始めるクラウドネイティブ/small start CloudNative
petitviolet
0
1.7k
2019年だからこそ12factor app/The Twelve-Factor app in 2019
petitviolet
1
970
実践GraphQL on Scala/Real world GraphQL on Scala
petitviolet
8
2.9k
Kubernetesを知る/Introduction Kubernertes
petitviolet
1
610
Microservices Batch on GAE
petitviolet
0
1.9k
Web API Design
petitviolet
18
8.1k
Property Based Testing introduction
petitviolet
1
110
Other Decks in Programming
See All in Programming
Remix on Hono on Cloudflare Workers
yusukebe
1
280
광고 소재 심사 과정에 AI를 도입하여 광고 서비스 생산성 향상시키기
kakao
PRO
0
170
イベント駆動で成長して委員会
happymana
1
320
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
1
290
Jakarta EE meets AI
ivargrimstad
0
580
色々なIaCツールを実際に触って比較してみる
iriikeita
0
330
Enabling DevOps and Team Topologies Through Architecture: Architecting for Fast Flow
cer
PRO
0
310
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
120
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
170
Arm移行タイムアタック
qnighy
0
310
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
Featured
See All Featured
The Cost Of JavaScript in 2023
addyosmani
45
6.7k
How to Ace a Technical Interview
jacobian
276
23k
Practical Orchestrator
shlominoach
186
10k
A Philosophy of Restraint
colly
203
16k
The Pragmatic Product Professional
lauravandoore
31
6.3k
What's new in Ruby 2.0
geeforr
343
31k
Music & Morning Musume
bryan
46
6.2k
Why Our Code Smells
bkeepers
PRO
334
57k
Six Lessons from altMBA
skipperchong
27
3.5k
Side Projects
sachag
452
42k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
Facilitating Awesome Meetings
lara
50
6.1k
Transcript
(SBQI2-PO4DBMB 'SJOHF$P -UE!QFUJUWJPMFU
ͰɺͩΕʁ w )JSPLJ,PNVSBTBLJ w 8FC্Ͱ!QFUJUWJPMFU w 'SJOHFגࣜձࣾ w 4DBMBྺ΄Ͳ 2
ࠓ͢͜ͱ w Կʹ(SBQI2-Λ͍ͬͯΔͷ͔ w ͳͥ(SBQI2-Λ͍ͬͯΔͷ͔ w 4DBMBͰ(SBQI2-͢Δ w ͬͯΈͯͲ͏͔ 3
Կʹ(SBQI2-Λ ͍ͬͯΔͷ͔ 4
Կʹ(SBQI2-Λ͍ͬͯΔͷ͔ w ΞυωοτϫʔΫͷཧը໘ͷαʔόαΠυ"1* w ࠂͷ৴ઃఆΛཧ͢Δը໘ͷཪଆ w ඇެ։෦"1*ͱͯ͠ͷ(SBQI2- w ΫϥΠΞϯτ&MNͰ41" w
2VFSZ.VUBUJPOͲͪΒ(SBQI2- w Ұ෦ඇ(SBQI2- 5
ͳͥ(SBQI2-Λ ͍ͬͯΔͷ͔ 6
ͳͥ(SBQI2-Λ͍ͬͯΔͷ͔ w ʮ͑ͬɺ͜ͷϖʔδදࣔ͢Δͷʹճ"1*Λʁʯ w Կͱ͔͍͚ͨ͠Ͳ3&45ͱંΓ߹͍͕͔ͭͳ͍ w ʮԶҰମԿΛʜʯΛආ͚͔ͨͬͨ w 63*ઃܭ1045165%&-&5&ͰΉͱ͔ w
ྺ࢙ʹֶΜͩ w 3&45ɺૢ࡞ࢦɺ+40/31$ͳͲ w ۜͷؙΛ୳͢ʑ 7
https://speakerdeck.com/petitviolet/web-api-design
https://speakerdeck.com/petitviolet/web-api-design Ͳ͏Β(SBQI2-͕͍͍Β͍͠
ͳͥ(SBQI2-Λ͍ͬͯΔͷ͔ w ΫϥΠΞϯτଆʹ3FBEܥͷΛد͍ͤͨ w %%%ͬͯͯ3FBEܥͷཁٻʹԠ͑Δͷ͕͖͍ͭ w 9YY3FQPTJUPSZ͕pOE#Z:ZZͩΒ͚ʹ w λΠϛϯά͕ྑ͔ͬͨ w
৽نϓϩδΣΫτൃ w αʔόαΠυʹ͕ࣗΞαΠϯ͞Εͨ w (SBQI2-Θ͔ΔΤϯδχΞ͕ϑϩϯτʹ 10
4DBMBͰ(SBQI2-͢Δ 11
4DBMBͰ(SBQI2-͢Δ w TBOHSJBHSBQIRMTBOHSJBΛ͏ w 4DBMBͷ(SBQI2-ϑϨʔϜϫʔΫ w 8FCϑϨʔϜϫʔΫಛʹΘͳ͍ w *'+40/Ͱɺ+40/ϥΠϒϥϦෳରԠ 12
งғؾ case class MyObject(id: Long, name: String) val myObjectType: ObjectType[Unit,
MyObject] = derive.deriveObjectType() val myQuery: ObjectType[MyObjectRepository, Unit] = { ObjectType.apply( "MyQuery", fields[MyObjectRepository, Unit]( { val idArg = Argument("id", LongType) Field( "findById", OptionType(myObjectType), arguments = idArg :: Nil, resolve = ctx => ctx.ctx.findById(ctx.arg(idArg))) }, Field("all", ListType(myObjectType), resolve = ctx => Future { ctx.ctx.findAll }) ) ) } 13
งғؾ case class MyObject(id: Long, name: String) val myObjectType: ObjectType[Unit,
MyObject] = derive.deriveObjectType() val myQuery: ObjectType[MyObjectRepository, Unit] = { ObjectType.apply( "MyQuery", fields[MyObjectRepository, Unit]( { val idArg = Argument("id", LongType) Field( "findById", OptionType(myObjectType), arguments = idArg :: Nil, resolve = ctx => ctx.ctx.findById(ctx.arg(idArg))) }, Field("all", ListType(myObjectType), resolve = ctx => Future { ctx.ctx.findAll }) ) ) } (SBQI2-ͷUZQF 14
งғؾ case class MyObject(id: Long, name: String) val myObjectType: ObjectType[Unit,
MyObject] = derive.deriveObjectType() val myQuery: ObjectType[MyObjectRepository, Unit] = { ObjectType.apply( "MyQuery", fields[MyObjectRepository, Unit]( { val idArg = Argument("id", LongType) Field( "findById", OptionType(myObjectType), arguments = idArg :: Nil, resolve = ctx => ctx.ctx.findById(ctx.arg(idArg))) }, Field("all", ListType(myObjectType), resolve = ctx => Future { ctx.ctx.findAll }) ) ) } ܕͷࣗಈಋग़ 15
งғؾ case class MyObject(id: Long, name: String) val myObjectType: ObjectType[Unit,
MyObject] = derive.deriveObjectType() val myQuery: ObjectType[MyObjectRepository, Unit] = { ObjectType.apply( "MyQuery", fields[MyObjectRepository, Unit]( { val idArg = Argument("id", LongType) Field( "findById", OptionType(myObjectType), arguments = idArg :: Nil, resolve = ctx => ctx.ctx.findById(ctx.arg(idArg))) }, Field("all", ListType(myObjectType), resolve = ctx => Future { ctx.ctx.findAll }) ) ) } DPOUFYUͱͯ͠ 3FQPTJUPSZΛ༻ 16
งғؾ case class MyObject(id: Long, name: String) val myObjectType: ObjectType[Unit,
MyObject] = derive.deriveObjectType() val myQuery: ObjectType[MyObjectRepository, Unit] = { ObjectType.apply( "MyQuery", fields[MyObjectRepository, Unit]( { val idArg = Argument("id", LongType) Field( "findById", OptionType(myObjectType), arguments = idArg :: Nil, resolve = ctx => ctx.ctx.findById(ctx.arg(idArg))) }, Field("all", ListType(myObjectType), resolve = ctx => Future { ctx.ctx.findAll }) ) ) } OVMMBCMF0QUJPOͰදݱ 17
งғؾ case class MyObject(id: Long, name: String) val myObjectType: ObjectType[Unit,
MyObject] = derive.deriveObjectType() val myQuery: ObjectType[MyObjectRepository, Unit] = { ObjectType.apply( "MyQuery", fields[MyObjectRepository, Unit]( { val idArg = Argument("id", LongType) Field( "findById", OptionType(myObjectType), arguments = idArg :: Nil, resolve = ctx => ctx.ctx.findById(ctx.arg(idArg))) }, Field("all", ListType(myObjectType), resolve = ctx => Future { ctx.ctx.findAll }) ) ) } ඇಉظॲཧ 'VUVSF ͕؆୯ 18
4DBMBͰ(SBQI2-͢Δ w 4BOHSJBػೳ͕ेʹଗ͍ͬͯΔ w ඇಉظॲཧ w ϚΫϩʹΑΔUZQFͷࣗಈಋग़ w +40/ͱͷ૬ޓม w
DBTFDMBTTͱ(SBQI2-Λ+40/͕ܨ͙ w / ղܾ w 'FUDIFS%FGFSSFE3FTPMWFS w 3FMBZαϙʔτ w TBOHSJBHSBQIRMTBOHSJBSFMBZ 19
(SBQI2-Λ4DBMBͰ ͬͯΈͯͲ͏͔ 20
(SBQI2-ΛͬͯΈͯͲ͏͔ w ײͱͯ͠ɺ(SBQI2-ʹͯ͠ྑ͔ͬͨ w ͍ΖΜͳ͜ͱ͔Βղ์͞Εͨ w ʮͱΓ͋͑ͣશ෦ฦ͔͢Β͋ͱΑΖ͘͠ʯͷָ͞ w ؔ࿈ΦϒδΣΫτSFTPMWFͰؤு࣮ͬͯ w
ͿͬͪΌ͚Ͳ͏ͬͯΔ͔Α͘Βͳ͍ w 4DBMBͱ(SBQI2-ܕ༷ͷ૬ੑͷྑ͞ w ૉʹදݱͰ͖Δ҆͠શʹָʹ։ൃͰ͖Δ w OPOOVMMΛίϯύΠϥͰڧ੍Ͱ͖Δ 21
͠ΜͲ͍͜ͱɺΜͰ͍Δ͜ͱ w (SBQI2-ͷֶशίετͦΕͳΓʹ͔͔Δ w εΩʔϚͷ࡞ΓํʹΉ w ϨΠϠʔυΞʔΩςΫνϟͰͷཱͪҐஔ w ೝূ͕ΞμϓλͰΒ͟ΔΛಘͳ͍ w
&OVNΛυϝΠϯͱڞ༗͢Δ͖͔ 22
·ͱΊ 23
(SBQI2-PO4DBMB w 4DBMBͰ(SBQI2-ɺेΕΔ w TBOHSJBHSBQIRMTBOHSJBͷ͓͔͛ w (SBQI2-ͷ༷ΛͪΌΜͱຬͨͤΔ w (SBQI2-ͬͯΈͯΑ͔ͬͨ w
࣍ʹԿ͔࡞Δͱͯ͠࠾༻͍ͨ͠ w ֶशίετ͔͔ΔͷͰνʔϜʹΑΔ 24
5IBOLZPV 25