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
Nuxt で GraphQL のクエリを送信する方法
Search
SAW
February 29, 2024
Programming
2
150
Nuxt で GraphQL のクエリを送信する方法
v-kansai Meetup #15 の発表資料です。
SAW
February 29, 2024
Tweet
Share
More Decks by SAW
See All by SAW
GraphQL はいいぞ! ~Laravel で学ぶ GraphQL 入門~
azuki
1
210
OSS contributor への第一歩を踏み出すまでの物語
azuki
1
140
Eloquent で relation を扱う基礎
azuki
0
64
メイキング・オブ・PHPカンファレンス 〜PHPカンファレンス関西2024の運営スタッフが語る舞台裏〜
azuki
0
54
ブラウザでテキストを読み上げる
azuki
0
91
計画性ないけれどノリと勢いだけで地方でも勉強会を開くすゝめ 〜 PHPカンファレンス関西2024 の懇親会 LT のその後 〜
azuki
0
46
GraphQL 入門
azuki
1
84
JavaScript で音声認識を試してみよう
azuki
0
110
Voice Recognition in JavaScript
azuki
0
44
Other Decks in Programming
See All in Programming
Using Livebook to build and deploy internal tools @ ElixirConf 2024
hugobarauna
0
230
2024 컴포즈 정원사
jisungbin
0
150
GoのIteratorに詳しくなってしまう
inatonix
1
190
事業フェーズの変化に対応する 開発生産性向上のゼロイチ
masaygggg
0
120
Some more adventure of Happy Eyeballs
coe401_
2
160
connect-go で面倒くささと戦う / 2024-08-27 #newmo_layerx_go
izumin5210
2
610
Jakarta EE meets AI
ivargrimstad
1
110
Modular Monolith Go Server with GraphQL Federation + gRPC
110y
1
570
Scala におけるコンパイラエラーとの付き合い方
chencmd
2
380
Prolog入門
qnighy
3
560
Regular Expressions, REXML, Automata Learning
makenowjust
0
190
オートマトン学習しろ / Do automata learning
makenowjust
3
110
Featured
See All Featured
Code Review Best Practice
trishagee
62
16k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
45
4.8k
The Pragmatic Product Professional
lauravandoore
31
6.2k
Design by the Numbers
sachag
277
19k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
28
1.6k
The Invisible Side of Design
smashingmag
295
50k
In The Pink: A Labor of Love
frogandcode
139
22k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
26
1.9k
Making Projects Easy
brettharned
113
5.8k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.4k
Build The Right Thing And Hit Your Dates
maggiecrowley
30
2.2k
Navigating Team Friction
lara
183
13k
Transcript
/VYUͰ(SBQI2-ͷΫΤϦΛૹ৴͢Δํ๏ 3FCPPUWLBOTBJ.FFUVQ 4"8
$(whoami) ࢯ໊Ճ౻फҰ ࡀ ϋϯυϧωʔϜ4"8 ؔͷ*5ΤϯδχΞίϛϡχςΟͷ͔͠୲ ࣗশ େࡕࡏॅɾѪग़ 9
چ5XJUUFS !B[VLJ@FBUFS ಘҙ8FCΞϓϦέʔγϣϯ։ൃ 7VF -BSBWFM 2
ಈػ/VYU͔Β(SBQI2-ͷΫΤϦΛૹ৴͍ͨ͠ /VYUͰϑϩϯτΤϯυΛ։ൃ όοΫΤϯυ-BSBWFMͰ։ൃ "1*(SBQI2-Λར༻ /VYU͔Β(SBQI2-ͷΫΤϦΛૹ৴ͯ͠σʔλΛऔಘ͍ͨ͠ /VYU͚ͷ(SBQI2-$MJFOUΛར༻͍ͨ͠ 3 ϑϩϯτΤϯυ όοΫΤϯυ ϦΫΤετ
Ϩεϙϯε
/VYUͷͨΊͷ(SBQI2-ΫϥΠΞϯτ /VYUͷެࣜυΩϡϝϯτͷ/VYU.PEVMFT͔Βݕࡧ /VYU(SBQI2-$MJFOU /VYUͷͨΊͷHSBQIRMSFRVFTU (SBQI2-$PEF(FOFSBUPSͷ࠷খߏ /VYU"QPMMP /VYUͷͨΊͷ"QPMMP$MJFOU (SBQI2-3FRVFTU.PEVMF ࠷খͷ(SBQI2-ΫϥΠΞϯτͷͨΊͷαϙʔτΛ͢ΔͨΊͷ/VYUϞδϡʔϧ 4
/VYU(SBQI2-$MJFOUͷಛ (SBQI2-ͷΫΤϦΛผϑΝΠϧʹهड़ 7VFͷίʔυ͔Β(SBQI2-ͷΫΤϦΛՄೳ ݸਓతਪ͠ϙΠϯτ ΄΅ઃఆͳ͠Ͱར༻Մೳ nuxt.config.tsͷmodulesͱڥมͷઃఆͷΈ 5ZQF4DSJQUΛશαϙʔτ (SBQI2-ͷΫΤϦΛͱʹϨεϙϯεͷܕใΛࣗಈੜ 5
/VYU(SBQI2-$MJFOUͷجຊతͳ͍ํ (SBQI2-ͷΫΤϦΛهड़ ϑΝΠϧͷ֦ுࢠ.gql·ͨ.graphql useAsyncGql()Λݺͼग़͠ ΫΤϦoperation͔Βࢦఆ 6 query getCountries
{ countries { code name } } const { data } = await useAsyncGql({ operation: 'getCountries', }); (SBQI2-ͷΫΤϦ໊Λ VTF"TZOD(RM ͷ PQFSBUJPOʹࢦఆ
ඞཁ࠷খݶͷઃఆ nuxt.config.tsͷmodulesΛՃ (SBQI2-αʔόʔͷ63-Λ֨ೲ͢ΔڥมΛઃఆ (SBQI2-αʔόʔͷ63-Λ.envͷGQL_HOSTʹઃఆ 7 export default defineNuxtConfig({ modules: ['nuxt-graphql-client'],
}); nuxt.config.ts GQL_HOST='https://localhost/graphql' .env
5ZQF4DSJQUશαϙʔτͷڧΈ (SBQI2-ͷΫΤϦ͔Βฦ٫ܕͷใΛࣗಈੜ useAsyncGql()ͷฦΓͷ5ZQF)JOUJOHʹө 8 (SBQI2-$PEF(FOFSBUPSͰ ΫΤϦ͔ΒܕใΛࣗಈੜ
(SBQI2-ͷWBSJBCMFTͷࢦఆ useAsyncGql()ͷҾ͔ΒมΛࢦఆ ΫΤϦมvariables͔Βࢦఆ ΫΤϦͷม͕5ZQF)JOUJOHʹө 9 (SBQI2-$PEF(FOFSBUPSͰ ΫΤϦม͔ΒܕใΛࣗಈੜ
ࠔͬͨ ެࣜυΩϡϝϯτ͕ಡΈͮΒ͍ ެࣜυΩϡϝϯτҎ֎ͷใগͳΊ ϑΝΠϧͷΞοϓϩʔυ͕࣮Ͱ͖ͳͦ͞͏ ͦͦґଘύοέʔδͷHSBQIRMSFRVFTU͕ϑΝΠϧΞοϓϩʔυʹඇରԠ ϛυϧΣΞΛ࣮ͯ͠ΞοϓϩʔυΛ࣮ݱ͢Δ͜ͱՄೳ /YVU(SBQI2-$MJFOUʹHSBQIRMSFRVFTUͷϛυϧΣΞΛΈࠐΊͳͦ͞͏ 10
૯ׅ /VYU(SBQI2-$MJFOUʹ͍ͭͯհ (SBQI2-ͷΫΤϦΛ7VFϑΝΠϧ͔Βͯ͠هड़ ΄΅ઃఆͳ͠Ͱར༻Մೳ 5ZQF4DSJQUͷશαϙʔτͰ5ZQF)JOUJOH͕ར༻Մೳ /VYU(SBQI2-$MJFOUΛ͏্Ͱࠔͬͨ υΩϡϝϯτ͕ಡΈͮΒ͍ ϑΝΠϧΞοϓϩʔυʹະରԠͬΆ͍ 11
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠