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
41
5分でわかるSLO
bmf_san
2
60
権限について考える
bmf_san
2
72
自作HTTPルーターから新しいServeMuxへ
bmf_san
3
1.6k
古くなってしまったPHPフレームワークとPHPのバージョンアップ戦略
bmf_san
1
270
アジャイルワークショップ
bmf_san
0
100
Makuakeの認証基盤とRe-Architectureチーム
bmf_san
0
2.4k
天下一HTTPRouter武闘会.pdf
bmf_san
8
4.3k
ゆっくりHackerRank
bmf_san
0
110
Featured
See All Featured
Building an army of robots
kneath
302
44k
Making Projects Easy
brettharned
116
5.9k
A Philosophy of Restraint
colly
203
16k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
28
900
Scaling GitHub
holman
458
140k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
4 Signs Your Business is Dying
shpigford
181
21k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
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͍͟·ͨ͠ʂ