Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Hono v3 and v4
Search
Yusuke Wada
November 19, 2023
Programming
4
3.9k
Hono v3 and v4
JSConf JP
Nov 19, 2023. Yusuke Wada
Yusuke Wada
November 19, 2023
Tweet
Share
More Decks by Yusuke Wada
See All by Yusuke Wada
Remix on Hono on Cloudflare Workers
yusukebe
2
390
僕がつくった48個のWebサービス達
yusukebe
20
17k
Honoの来た道とこれから
yusukebe
20
4.6k
JS RPCを理解する
yusukebe
5
700
Honoとhtmx
yusukebe
6
1.8k
Cloudflare Workersの環境を再現することについて
yusukebe
7
1k
Hono v4
yusukebe
11
4.9k
The power of Web-standards
yusukebe
4
1.7k
実践エッジユースケース
yusukebe
7
2.2k
Other Decks in Programming
See All in Programming
ペアーズにおけるAmazon Bedrockを⽤いた障害対応⽀援 ⽣成AIツールの導⼊事例 @ 20241115配信AWSウェビナー登壇
fukubaka0825
6
2.3k
社内活動の取り組み紹介 ~ スリーシェイクでこんな取り組みしてます ~
bells17
0
380
カンファレンスでLTしました / kashiwarb5
nhayato
0
100
The rollercoaster of releasing an Android, iOS, and macOS app with Kotlin Multiplatform | droidcon Italy
prof18
0
130
テスト自動化失敗から再挑戦しチームにオーナーシップを委譲した話/STAC2024 macho
ma_cho29
0
380
型のインスタンス化は非常に深く、無限である可能性があります。
kimitashoichi
0
110
WebAssembly Unleashed: Powering Server-Side Applications
chrisft25
0
2.1k
Missing parts when designing and implementing Android UI
ericksli
0
390
Modular Monolith Monorepo ~シンプルさを保ちながらmonorepoのメリットを最大化する~
yuisakamoto
11
3.9k
.NET Conf 2024の振り返り
tomokusaba
0
190
クリエイティブコーディングとRuby学習 / Creative Coding and Learning Ruby
chobishiba
0
680
事業成長を爆速で進めてきたプロダクトエンジニアたちの成功談・失敗談
nealle
3
1.2k
Featured
See All Featured
Faster Mobile Websites
deanohume
305
30k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Designing Experiences People Love
moore
138
23k
Facilitating Awesome Meetings
lara
50
6.1k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
2
240
Transcript
Hono v3 and v4 JSConf JP Nov 19, 2023. Yusuke
Wada
ࣗݾհ • Yusuke Wada • Web framework developer • Developer
Advocate @Cloud fl are • Bokete co-founder • Creator of Hono • https://github.com/yusukebe
ࠓͷτϐοΫ 1. Hono v3.*ͷػೳ 2. Hono v4ͰͲ͏ͳΔͷ͔ʁ
Honoͱʁ • Web-framework runs on any JavaScript runtime. • Fast,
Lightweight, Web-standards. • Works on… • Cloud fl are Workers • Deno • Bun • Node.js • Fastly Compute • AWS Lambda • Vercel • Others! https://hono.dev
GitHub Stars ⭐
Who is using Hono? • cdnjs API Server • Poly
fi ll.io • Deno Docs • Ultra • Cloud fl are Blog • Workers SDK • Cloud fl are D1 • Drivly • SticAI • Skill Struck • Reejs • toddle • LanderLab • OpenStatus • Loglib • repeat.dev • Nodecraft • Hwy • Unkey • AI.LS • ExpenSee • Others!
v2·ͰͷҰൠతͳػೳ • ϧʔςΟϯά • Request/ResponseΛѻ͏ • Text/JSON/HTMLϨεϙϯεΛฦ͢ • ϛυϧΣΞΛ͏ •
BindingsɺมΛѻ͏ • Cloud fl are WorkersɺDenoɺBunͰಈ͔͢
v3.*ͰೖͬͨػೳΛհ͠·͢ • v3.0.0 => 2023/02/18ʹϦϦʔε • v.3.10.0 => 2023/11/13ʹϦϦʔε •
جຊతʹsemverΛक͍ͬͯΔͷͰminorϦϦʔεΛհ • ͋ͳ͕ͨΒͳ͍͔͠Εͳ͍Hono
v3.0.0 - 2023/02/18 • HonoRequest • RegExpRouter becomes the fastest
router • Good-bye StaticRouter • New Validator • RPC • Adapter • Muti-runtime CI Support • Support WinterCG Runtime Keys • create-hono • @honojs to @hono
RegExpRouter becomes the fastest router 20232݄࣌ͷϕϯνϚʔΫͰ͢ • RegExpRouter͕ JavaScriptքͰ1൪ ͍ϧʔλʔͷͻͱ
ͭʹͳͬͨ
New Validator • ബ͘ͳͬͨ • ZodɺValibotɺTypeBox ͳͲ֎෦ͷValidatorΛ ༻͢Δ3rd-partyϥΠϒ ϥϦ •
ܕ͚
RPC-mode • ΫϥΠϯτΛੜ͢Δ`hc()`Λಋೖ • αʔόʔଆͷܕΛड͚͠ɺAPIεϖοΫΛڞ༗͢Δ • tRPCͷΑ͏͕ͩɺ͍ͭͷΞϓϦΛ؆୯ʹҠߦͰ͖Δ • ྫ͑Zod/Zod Validator/hcͷελοΫͰͰ͖Δ
None
Multi-runtime CI Support 202311݄ݱࡏɺMainͷଞʹ7ͭͷϥΠϯλΠϜͷςετ͕Δ
v3.1.0 - 2023/03/17 • Improve RPC-mode • `env` for getting
environment variables for multi-runtimes • AWS Lambda Adapter • basePath() • c.req.path • Allow passing RequestInit to c.json() etc.
`env` for getting environment variables for multi-runtimes • ϥϯλΠϜʹґଘͤͣಁաతʹڥมΛऔಘ͢ΔͨΊͷ`env()`
AWS Lambda Adapter • AWS LambdaʹରԠ
v3.2.0 - 2023/05/19 • New Routers • Presets: `hono/tiny`, `hono/quick`
• app.mount() • Node.js adapter server v1.0.0 has been released • Support for routing includes a hostname
New Routers • LinearRouter • ϧʔςΟϯάͷొ͕͍ϧʔλʔ • PatternRouter • ͱʹ͔͘খ͍͞ϧʔλʔ
ܭ5ͭͷϧʔλʔʹͳͬͨ TrieRouter RegExpRouter SmartRouter LinearRouter PatternRouter
Presets: `hono/tiny`, `hono/quick` • `hono/tiny` • PatternRouterͷΈ • খ͍͞ •
13KB • `hono/quick` • LinearRouterͱTrieRouter • ϧʔτͷొ͕͍
ͲͷPresetΛ͏͖͔ hono ͍ DenoɺBunɺNode.js Cloud fl are Workers hono/quick ొ͕͍
Fastly Compute hono/tiny খ͍͞ Ϧιʔε͕ݶΒΕ͍ͯΔڥ
app.mount() • ͲΜͳ`fetch` ΞϓϦέʔγϣϯͰmountͰ͖Δ
itty-router, Remix, Qwik City, Solid StartͳͲ͍͚Δ
֤ϑϨʔϜϫʔΫ͕ΞμϓλΛ࡞͍ͬͯͨ
HonoʹϚϯτͤ͞ΕͲΜͳϓϥοτϑΥʔϜͰಈ͘
Node.js adapter server v1.0.0 • Poly fi llͳ͠ɺNode.jsωΠςΟϒͳWeb-standards APIͷΈΛ༻
v3.3.0 - 2023/07/11 • Server-Timing Middleware • Lambda@Edge Adapter
Server-Timing Middleware • Server-Timing APIΛͬͯύ ϑΥʔϚϯεܭଌ͕Ͱ͖Δ
v3.4.0 - 2023/08/08 • Netlify Adapter • Cookie Middleware supports
Signed Cookies
v3.5.0 - 2023/08/21 • Secure Headers Middleware • Introduce “Helpers”
• Zod OpenAPI Hono
Secure Headers Middleware • ηΩϡϦςΟʹ·ͭΘΔϔο μͷઃఆ͕Ͱ͖Δ • ExpressͷHelmet૬
Introduce “Helpers” • ϛυϧΣΞͱҧ͍ศརϝιουΛఏڙ͢Δ
ࠓ͋ΔHelpers • Adapter • Cookie • Factory • html •
JWT • Streaming • Testing
Zod OpenAPI Hono • ͷOpenAPIαϙʔτ • HonoΛϥοϓͨ͠Ϋϥε • Zodͱ”Zod to
OpenAPI”Λ͍ͬͯΔ
1. ZodͰεΩʔϚΛॻ͘
2. ϧʔτΛ࡞Δ
3. ΞϓϦʹ͢Δ
4. JSONͷυΩϡϝϯτ͕ు͚Δ
None
5. Swagger UI MiddlewareͱΈ߹ΘͤΔ
None
ܕ͕ͭ͘
v3.6.0 - 2023/09/11 • Introduce `c.render()` • Introduce `c.var` •
`FC` for JSX • `$url()` in Hono Client • Vite dev-server for Hono • Deprecate some properties in HonoRequest • Replaced Jest with Vitest
Introduce `c.render()` • HTMLͷϨΠΞτΛ؆୯ʹͭͬͯ͘దԠ͘͢͠ Middleware Handler Result
Vite dev-server for Hono • `@hono/vite-dev-server` • Viteͷಠࣗdev serverΛఏڙ͢ΔVite plugin
• Viteܦ༝Ͱ`fetch`ΞϓϦΛ։ൃͰ͖Δ • ࠶ىಈɺϦϩʔυ͕͍ • ϑϩϯτରԠ • Cloud fl areͷBindingsαϙʔτ͍ͯ͠Δ
None
v3.7.0 - 2023/09/21 • `c.stream()` and `c.streamText()` • Testing Helper
• JWT helper
`c.stream()` and `c.streamText()` • ͷStreamରԠ • Zod OpenAPIͱ߹ΘͤͯAI readyʹ
None
v3.8.0 - 2023/10/19 • JSX Context API • JSX Renderer
Middleware • Streaming Helper • Factory Helper • `parseBody()` supports multi values • Improve path matching in the router
JSX Renderer Middleware • `c.render()`Ͱ͏ͨΊͷϨΠΞτΛ JSXͰఆٛ͘͢͠ • `useRequestContext()`ͰContextΦ ϒδΣΫτ͕औΕΔΑ͏ʹͳΔ
Streaming Helper • `streamSSE()`ͰServer-Sent Events͕ు͚Δ
Factory Helper • `createMiddleware()`͕ຯʹศར • ܕղܾΛͬͯ͘Δ
v3.9.0 - 2023/10/27 • Improving the Developer Experience for JSX
• Clerk Middleware • New Starter Template for Cloud fl are Pages
Improving the Developer Experience for JSX • λάʹܕ͕͍ͭͨɻΤσΟλͰิॿͯ͘͠ΕΔ
New Starter Template for Cloudflare Pages • `@hono/vite-dev-server`Λར༻ͨ͠৽͍͠ελʔλʔ
v3.10.0 - 2023/11/13 • JSX supports Async Components • Introduce
`Suspense` and `renderToReadableStream()` • JSX Renderer Middleware supports `stream` • Support `@jsx precompile` for Deno
JSX supports Async Components • JSXͷίϯϙʔωϯτͷதͰasync/awaitͰ͖Δ
Introduce `Suspense` and `renderToReadableStream()` • AsyncComponent`fetch`͕ऴΘΔ·Ͱawait͢Δ • SuspenseΛ`renderToReadableStream()`ͱ͏ͱ`fetch`͕ऴΘΔؒ fallbackΛදࣔɺղܾ͞ΕͨΒ݁ՌΛදࣔ
None
None
JSX Renderer Middleware supports `stream` • `stream: true`ʹ͢Δ͜ͱͰ StreamingͷϨεϙϯεʹͳΔ
v3.*Ͱಋೖ͞ΕͨػೳΛΈ͖ͯ·ͨ͠ • v3.0.0 => 2023/02/18 • v3.1.0 => 2023/03/17 •
v3.2.0 => 2023/05/19 • v3.3.0 => 2023/07/11 • v3.4.0 => 2023/08/08 • v3.5.0 => 2023/08/21 • v3.6.0 => 2023/09/11 • v3.7.0 => 2023/09/21 • v3.8.0 => 2023/10/19 • v3.9.0 => 2023/10/27 • v3.10.0 => 2023/11/13
ͬͯΈͯͩ͘ ͍͞
v4?
v4? When? What?
What is introduced in v4?
File-base Routing??
Thanks