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
🔥 Hono v4 やってみた
Search
circled9
February 23, 2024
Technology
1
150
🔥 Hono v4 やってみた
circled9
February 23, 2024
Tweet
Share
More Decks by circled9
See All by circled9
キースイッチ入門
circled9
0
47
CloudflareのAI関連の機能さわってみた
circled9
0
380
0.0.0.0 day
circled9
0
72
小数の丸め誤差の話
circled9
0
97
数値の文字列をパースしよう
circled9
0
140
JetBrains AI Assistant を試してみた
circled9
1
420
Fresh
circled9
0
230
React Hooks 勉強会 vol.3
circled9
2
410
JSON.stringify()
circled9
2
470
Other Decks in Technology
See All in Technology
Amazon VPC Lattice 最新アップデート紹介 - PrivateLink も似たようなアップデートあったけど違いとは
bigmuramura
0
190
watsonx.ai Dojo #5 ファインチューニングとInstructLAB
oniak3ibm
PRO
0
160
Postman と API セキュリティ / Postman and API Security
yokawasa
0
200
サイバー攻撃を想定したセキュリティガイドライン 策定とASM及びCNAPPの活用方法
syoshie
3
1.2k
終了の危機にあった15年続くWebサービスを全力で存続させる - phpcon2024
yositosi
1
760
日本版とグローバル版のモバイルアプリ統合の開発の裏側と今後の展望
miichan
1
130
サーバレスアプリ開発者向けアップデートをキャッチアップしてきた #AWSreInvent #regrowth_fuk
drumnistnakano
0
190
re:Invent をおうちで楽しんでみた ~CloudWatch のオブザーバビリティ機能がスゴい!/ Enjoyed AWS re:Invent from Home and CloudWatch Observability Feature is Amazing!
yuj1osm
0
120
DevOps視点でAWS re:invent2024の新サービス・アプデを振り返ってみた
oshanqq
0
180
Snowflake女子会#3 Snowpipeの良さを5分で語るよ
lana2548
0
230
kargoの魅力について伝える
magisystem0408
0
200
20241220_S3 tablesの使い方を検証してみた
handy
3
360
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
427
64k
Making the Leap to Tech Lead
cromwellryan
133
9k
Music & Morning Musume
bryan
46
6.2k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
Typedesign – Prime Four
hannesfritz
40
2.4k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Faster Mobile Websites
deanohume
305
30k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
Building an army of robots
kneath
302
44k
Statistics for Hackers
jakevdp
796
220k
Transcript
🔥 Hono v4 ͬͯΈͨ Niigata 5min Tech #5 in Nagaoka
@circled9 1
ࣗݾհ @circled9 দҪɹਖ਼ࢤʢMatsui Masashiʣ גࣜձࣾϞχΫϧ ͚ࣾͷࡒγεςϜ࡞ͬͯ·͢ 60%ΩʔϘʔυ͓͡͞Μ 2
ࠓ͍ͨ͜͠ͱ • Hono͍͍ͧͱ͍͏ • v4Ͱ৽͘͠૿͑ͨػೳͷ • ࣮ࡍʹࢼͨ͠ײ 3
🔥 Hono 4
🔥 Hono is Կ ? • JavaScriptͷWebϑϨʔϜϫʔΫ • "Hono -
Ultrafast web framework for the Edges" 5
🔥 Hono is ... • 🚀 Ultrafast & Lightweight •
🌍 Multi-runtime • 🔋 Batteries Included • 😃 Delightful DX 6
🚀 Ultrafast & Lightweight • ΊͬͪΌ͍ɺ͍ͦͯܰ͠ • "The router RegExpRouter
is really fast. Not using linear loops. Fast." • "The hono/tiny preset is under 14kB. Hono has zero dependencies and uses only the Web Standard API." 7
🌍 Multi-runtime • େମͲ͜Ͱಈ͘ • "Works on Cloud fl are
Workers, Fastly Compute, Deno, Bun, AWS Lambda, or Node.js. The same code runs on all platforms." 8
🔋 Batteries Included • ඞཁͳͷେମ͋Δ • "Hono has built-in middleware,
custom middleware, third-party middleware, and helpers. Batteries included." 9
😃 Delightful DX • TypeScriptͰόονϦ • "Super clean APIs. First-class
TypeScript support. Now, we've got "Types"." 10
💪 ͦΕҎ֎ͷಛ 11
JSX const View = () => { return ( <html>
<body> <h1>Hello Hono!</h1> </body> </html> ) } app.get('/page', (c) => { return c.html(<View />) }) 12
hono/css const buttonClass = css` background-color: #fff; &:hover { background-color:
red; } ` 13
🔥 Hono v4 14
🔥 Hono v4 • Static Site Generation • Client Components
• File-based Routing 15
Static Site Generation • ੩తͳWebϖʔδΛॻ͖ग़ͤΔΑ͏ʹͳͬͨ • viteΛͬͯΊͬͪΌշదʹ։ൃͰ͖Δ • Β͍͠ɺ·ͩࢼ͍ͯ͠ͳ͍ 16
Client Components • hono/jsx͕ΫϥΠΞϯτͰಈ͘Α͏ʹͳͬͨ • ΫϥΠΞϯτͰಈ͘͠hooks͑Δ • ReactΛΈࠐΜͩͷͰͳࣗ͘લ࣮Β͍͠ʢʂʁʣ • ΊͪΌͪ͘Ό͍ܰ
17
εήʔʂ 18
File-based Routing • HonoXͱ͍͏ผύοέʔδ • ϑΝΠϧͷஔ͖ॴΛݩʹΑ͠ͳʹϧʔςΟϯάͯ͘͠ΕΔ • ϋΠυϨʔγϣϯ͢Δɾ͠ͳ͍Λ͚ΒΕΔ 19
✅ ͬͯΈͨ 20
✅ ͬͯΈͨ • TodoAppΛ࡞ͬͯΈͨ • DBͷอଘ໘ͳͷͰׂѪɺϝϞϦ্ʹอଘ͢Δ͚ͩ 21
ૉࡐͷຯΛੜ͔ͨ͠TodoApp 22
✅ Ͱ͖ͨʂ 23
✨ վળͯ͠ΈΔ • ݟ͕ͨΠϚΠνͳͷͰhono/cssͰ͖Ε͍ʹ͢Δ • νΣοΫϘοΫεͷ࣮ΛαϘͬͯͨͷͰɺνΣοΫͨ͠Βอଘ͢Δ Α͏ʹ͢Δ 24
✨ Ͱ͖ͨʂ 25
γϟϨΦπͳTodoApp 26
😭 ϑΥʔϜΘ͔ΒΜ • ϑΥʔϜΛ͏ػձ͕গͳ͔ͬͨͷͰϑΥʔϜͷ͜ͱ͕Θ͔Βͳ͍ • PUT/DELETEͰ͖ͳ͍ͷʁ • νΣοΫϘοΫεԡͨ࣌͠ʹformΛૹ৴͢ΔͷͲ͏͢Μͷʁ • etc...
27
ল • HTMLΛษڧ͢͜͠ͱʹͨ͠ • جૅతͳ͕͓ࣝΖ͔ͦʹͳͬͯ ͍ΔͷΛײͨ͡ • HTML5ͷࠒ͔Β͕ࣝࢭ·ͬͯ ͍Δͷײͨ͡ 28
📚 ·ͱΊ • Hono͍͍ͧ • ͍ɺ͍ܰɺΘ͔Γ͍͢ • Web Standardͱͯେࣄ 29