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
530
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
42
5分でわかるSLO
bmf_san
2
61
権限について考える
bmf_san
2
73
自作HTTPルーターから新しいServeMuxへ
bmf_san
3
1.6k
古くなってしまったPHPフレームワークとPHPのバージョンアップ戦略
bmf_san
1
280
アジャイルワークショップ
bmf_san
0
110
Makuakeの認証基盤とRe-Architectureチーム
bmf_san
0
2.4k
天下一HTTPRouter武闘会.pdf
bmf_san
8
4.3k
ゆっくりHackerRank
bmf_san
0
110
Featured
See All Featured
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
3
180
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
Building Adaptive Systems
keathley
38
2.3k
Gamification - CAS2011
davidbonilla
80
5.1k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
For a Future-Friendly Web
brad_frost
175
9.5k
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Bash Introduction
62gerente
609
210k
Java REST API Framework Comparison - PWX 2021
mraible
28
8.3k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
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͍͟·ͨ͠ʂ