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
net/httpでつくるHTTPルーター自作入門
Search
bmf_san
November 13, 2021
0
540
net/httpでつくるHTTPルーター自作入門
https://gocon.jp/2021autumn/sessions/handmade-http-router/
bmf_san
November 13, 2021
Tweet
Share
More Decks by bmf_san
See All by bmf_san
契約テストとPactについて
bmf_san
0
48
5分でわかるSLO
bmf_san
2
68
権限について考える
bmf_san
2
76
自作HTTPルーターから新しいServeMuxへ
bmf_san
3
1.6k
古くなってしまったPHPフレームワークとPHPのバージョンアップ戦略
bmf_san
1
300
アジャイルワークショップ
bmf_san
0
110
Makuakeの認証基盤とRe-Architectureチーム
bmf_san
0
2.4k
天下一HTTPRouter武闘会.pdf
bmf_san
8
4.3k
ゆっくりHackerRank
bmf_san
0
120
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1366
200k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.2k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
A Tale of Four Properties
chriscoyier
157
23k
How to Think Like a Performance Engineer
csswizardry
22
1.3k
It's Worth the Effort
3n
183
28k
Rails Girls Zürich Keynote
gr2m
94
13k
Docker and Python
trallard
43
3.2k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Understanding Cognitive Biases in Performance Measurement
bluesmoon
27
1.5k
Into the Great Unknown - MozCon
thekraken
34
1.6k
Transcript
net/httpͰͭ͘Δ HTTPϧʔλʔࣗ࡞ೖ @bmf_san Go Conference 2021 Autumn
• Kenta Takeuchi • @bmf_san • גࣜձࣾϚΫΞέ/Re-ArchitectureνʔϜ • ֤छΤϯδχΞืूதͰ͢ʂ ࣗݾհ
ࠓ͢͜ͱ GoͰඪ४ύοέʔδ͚ͩΛͬͯɺ HTTPϧʔλʔΛࣗ࡞͢Δ
͜Μͳํʹ • Goͷॳֶऀ • GoͰԿ͔࡞ͬͯΈ͍ͨਓ • ݴޠΘͣHTTPϧʔλʔΛ࡞ͬͯΈ͍ͨਓ
ࣗ࡞ͯ͠ΈΔͱɾɾ • net/httpͷཧղΛਂΊΔ͖͔͚ͬʹ • ΞϧΰϦζϜͱσʔλߏΛֶͿ͖͔͚ͬʹ • ੈͷதͷHTTPϧʔλʔͷߏ͕େମ͔ΔΑ͏ʹ • ࣗ࡞ͷϧʔλʔͰΞϓϦΛ࡞ΕΔΑ͏ʹ
લఏ • Goͷجຊతͳจ๏ͷཧղ • Կ͔͠ΒͷHTTPϧʔλʔΛͬͨ͜ͱ͕͋Δ
Zenn Book
࣍ • HTTPϧʔλʔͱԿ͔ • HTTPϧʔλʔͷσʔλߏ • net/httpʹ͍͓͖͍ͭͯͬͯͨ͜ͱ • ࣮ͷհ
HTTPϧʔλʔͱ • ϦΫΤετ͞ΕΔURLͱϨεϙϯεͷॲཧΛ݁ͼ͚ͭΔ
HTTPϧʔλʔͷσʔλߏ • ϦΫΤετ͞ΕΔURLͱϨεϙϯεͷॲཧ Λ݁ͼ͚ͭΔ URLͱॲཧ͕Ϛοϐϯά͞Εͨ σʔλ͕ඞཁ
HTTPϧʔλʔͷσʔλߏ • URLͷ֊ → ߏͱͯ͠දݱ
• ʹϊʔυΛՃ͢Δ㲈ϧʔτͷఆٛ • ͔ΒϊʔυΛ୳ࡧ͢Δ㲈ϧʔςΟϯά HTTPϧʔλʔͷσʔλߏ
net/httpʹ͍͓͖͍ͭͯͬͯͨ͜ͱᶃ • ʮϚϧνϓϨΫαʯͱʮϋϯυϥʯ • ϚϧνϓϨΫα • ϦΫΤετͷURLΛొࡁΈͷύλʔϯͱরΒ͠߹Θͤ ͯɺ࠷Ϛον͢ΔϋϯυϥΛݺͼग़͢ • ϋϯυϥ
• ϦΫΤετʹԠͨ͡ॲཧΛฦ͢
net/httpʹ͍͓͖͍ͭͯͬͯͨ͜ͱᶄ • ϚϧνϓϨΫα • Ͳ͜ͰɺͲͷΑ͏ʹϋϯυϥΛొ͍ͯ͠Δͷ͔ • Ͳ͜ͰɺͲͷΑ͏ʹURLͱύλʔϯͷϚονϯάΛߦ͍ͬͯ Δ͔ • ϋϯυϥ
• ͲͷΑ͏ʹϋϯυϥΛ࣮͢Δͷ͔ • HandleɺHandlerɺHandleFuncɺHandlerFuncΛΔ • ຬ͍ͨͨ͠ΠϯλʔϑΣʔεԿ͔
• ͜ͷܗͷHTTPαʔόʔͷίʔυΛಡΈղ͘ͷ͕͓͢͢Ί ίʔυϦʔσΟϯά
• ϝιουϕʔεͷϧʔτఆٛΛαϙʔτ͚ͨͩ͠ͷ؆қతͳϧʔλʔͷ࣮ • ґଘඪ४ύοέʔδͷΈ ࣮ https://github.com/bmf-san/introduction-to-golang-http-router-made-with-net-http/
Github https://github.com/bmf-san/goblin
ؔ࿈ϦϯΫ ݻఆπΠʔτʹͿΒԼ͛ͯ͋Γ·͢
͋Γ͕ͱ͏Go͍͟·ͨ͠ʂ