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
510
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
38
5分でわかるSLO
bmf_san
2
55
権限について考える
bmf_san
2
67
自作HTTPルーターから新しいServeMuxへ
bmf_san
3
1.6k
古くなってしまったPHPフレームワークとPHPのバージョンアップ戦略
bmf_san
1
260
アジャイルワークショップ
bmf_san
0
94
Makuakeの認証基盤とRe-Architectureチーム
bmf_san
0
2.3k
天下一HTTPRouter武闘会.pdf
bmf_san
8
4.2k
ゆっくりHackerRank
bmf_san
0
110
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
88
5.7k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
10 Git Anti Patterns You Should be Aware of
lemiorhan
655
59k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
Designing Experiences People Love
moore
138
23k
Speed Design
sergeychernyshev
25
620
Typedesign – Prime Four
hannesfritz
40
2.4k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
Designing for Performance
lara
604
68k
Scaling GitHub
holman
458
140k
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͍͟·ͨ͠ʂ