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
140
🔥 Hono v4 やってみた
circled9
February 23, 2024
Tweet
Share
More Decks by circled9
See All by circled9
キースイッチ入門
circled9
0
42
CloudflareのAI関連の機能さわってみた
circled9
0
340
0.0.0.0 day
circled9
0
66
小数の丸め誤差の話
circled9
0
91
数値の文字列をパースしよう
circled9
0
120
JetBrains AI Assistant を試してみた
circled9
1
390
Fresh
circled9
0
220
React Hooks 勉強会 vol.3
circled9
2
400
JSON.stringify()
circled9
2
460
Other Decks in Technology
See All in Technology
iOS/Androidで同じUI体験をネ イティブで作成する際に気をつ けたい落とし穴
fumiyasac0921
1
110
【Startup CTO of the Year 2024 / Audience Award】アセンド取締役CTO 丹羽健
niwatakeru
0
990
データプロダクトの定義からはじめる、データコントラクト駆動なデータ基盤
chanyou0311
2
310
【Pycon mini 東海 2024】Google Colaboratoryで試すVLM
kazuhitotakahashi
2
500
100 名超が参加した日経グループ横断の競技型 AWS 学習イベント「Nikkei Group AWS GameDay」の紹介/mediajaws202411
nikkei_engineer_recruiting
1
170
IBC 2024 動画技術関連レポート / IBC 2024 Report
cyberagentdevelopers
PRO
0
110
ドメイン名の終活について - JPAAWG 7th -
mikit
33
20k
OCI 運用監視サービス 概要
oracle4engineer
PRO
0
4.8k
誰も全体を知らない ~ ロールの垣根を超えて引き上げる開発生産性 / Boosting Development Productivity Across Roles
kakehashi
1
220
Why App Signing Matters for Your Android Apps - Android Bangkok Conference 2024
akexorcist
0
120
Application Development WG Intro at AppDeveloperCon
salaboy
0
180
TypeScript、上達の瞬間
sadnessojisan
46
13k
Featured
See All Featured
A Philosophy of Restraint
colly
203
16k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Code Review Best Practice
trishagee
64
17k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
410
How GitHub (no longer) Works
holman
310
140k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
Navigating Team Friction
lara
183
14k
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