Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
社内LT
Search
tomoki_nmb
December 01, 2024
50
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
社内LT
配列にクエリを含める
tomoki_nmb
December 01, 2024
Featured
See All Featured
How to Think Like a Performance Engineer
csswizardry
28
2.9k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
7k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
The Pragmatic Product Professional
lauravandoore
37
7.5k
brightonSEO & MeasureFest 2025 - Winning Strategies for Black Friday CRO & PPC - Christian Goodrich
cargoodrich
3
870
The World Runs on Bad Software
bkeepers
PRO
72
12k
Deep Space Network (abreviated)
tonyrice
0
370
From π to Pie charts
rasagy
1
400
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
490
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
2
2k
How Software Deployment tools have changed in the past 20 years
geshan
2
35k
Transcript
クエリパラメータに配列を含めたい
自己紹介 名前:難波智貴 チーム:Cosmos 基盤 技術:Go TypeScript React GCP 趣味:食べること →
運動 (30 ↓ 20 ↑ 3↓)
今回のターゲット • 今まで GraphQL をメインで開発していてREST よくわからん • BE メインでFE のことよくわからんん
クエリパラメータ : サーバーに送りたいデータを URLに付与する https://www.example.com/search ? q=test & sort=desc •
?:クエリパラメータが始める • key=value:クエリパラメータ • &:複数のクエリパラメータを区切る
配列をクエリパラメータに含めたいとき
配列のクエリパラメータの例 1. id=1,2,3 2. id[]=1&id[]=2 3. id[1]=1&id[2]=2 4. FE側で配列をエンコードして文字列で送る BE
側の修正が必要
FE都合でBEの実装を 変えたくない
qs:クエリパラメータの keyをいい感じに変換してくれる http://localhost:8001/todos?labelIDs[]=1&labelIDs[]=2&labelIDs[]=3 http://localhost:8001/todos?&limit=10&labelIDs=1&labelIDs=2&labelIDs=3 ライブラリ使用前 ライブラリ使用後
Axios に設定
ライブラリ使用前 ライブラリ使用後 BE 動作確認
GraphQLのデータ取得 (余談) https://api.example.com/graphql
まとめ • REST で クエリパラメータのクエリパラメータは key-value の 関係なので配列を送りたいときは注意が必要 • qs
ライブラリ使ってみてね
まとめ