NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm, #1282 most downloaded on npm
Web framework built on Web Standards
Latest stable
4.13.17
Last release 15 days ago
07 Nov 2026
Ships on a steady schedule
a new release about every 2 weeks
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
5 years old
461 releases · first in 2021
Drag across the ruler to compare, or tap a release to open it.
fix(jwt): Make JWT Header typ Field Optional to Enhance Compatibility by @naporin0624 in https://github.com/honojs/hono/pull/2488
typ Field Optional to Enhance Compatibility by @naporin0624 in https://github.com/honojs/hono/pull/2488baseUrl for testClient by @yusukebe in https://github.com/honojs/hono/pull/2496OutputTypeExcludeResponseType when InputType is unknown by @nagasawaryoya in https://github.com/honojs/hono/pull/2500Full Changelog: https://github.com/honojs/hono/compare/v4.2.3...v4.2.4
fix(ssg): use response header to mark as disabled routes for SSG by @usualoma in https://github.com/honojs/hono/pull/2477
package.json correctly by @yusukebe in https://github.com/honojs/hono/pull/2483Full Changelog: https://github.com/honojs/hono/compare/v4.2.2...v4.2.3
Your coding agent can read these notes before it upgrades. Set up the MCP server →
feat(jsx-renderer): pass the context as 2nd arg by @yusukebe in https://github.com/honojs/hono/pull/2459
null correctly by @yusukebe in https://github.com/honojs/hono/pull/2469Full Changelog: https://github.com/honojs/hono/compare/v4.2.1...v4.2.2
fix(jws): Only import necessary helper (not all helpers) by @nicksrandall in https://github.com/honojs/hono/pull/2458
Full Changelog: https://github.com/honojs/hono/compare/v4.2.0...v4.2.1
Hono v4.2.0 is now available! Let's take a look at the new features.
Hono v4.2.0 is now available! Let's take a look at the new features.
The number of algorithms that JWT util can handle has increased from only 3 to 13! This means that JWT util now implements many of the algorithms supported by JWT.
You can use these algorithms from the JWT middleware or JWT helpers. Thanks @Code-Hex!
Method Override Middleware has been added. This middleware override the method of the real request with the specified method.
HTML form does not allow you to send a DELETE method request. Instead, by sending an input with name as _method and a value of DELETE, you can call the handler registered in app.delete().
const app = new Hono()
// If no options are specified, the value of `_method` in the form,
// e.g. DELETE, is used as the method.
app.use('/posts', methodOverride({ app }))
app.delete('/posts', (c) => {
// ....
})
Trailing Slash Middleware resolves the handling of Trailing Slashes in GET requests. You can use appendTrailingSlash and trimTrailingSlash functions.
For example, it redirects a GET request to /about/me to /about/me/.
import { Hono } from 'hono'
import { appendTrailingSlash } from 'hono/trailing-slash'
const app = new Hono({ strict: true })
app.use(appendTrailingSlash())
app.get('/about/me/', (c) => c.text('With Trailing Slash'))
Thanks @rnmeow!
extensionMap https://github.com/honojs/hono/pull/2382userId hook https://github.com/honojs/hono/pull/2389payload https://github.com/honojs/hono/pull/2424options.origin function https://github.com/honojs/hono/pull/2436vary header option https://github.com/honojs/hono/pull/2426cause option https://github.com/honojs/hono/pull/2224NO_COLOR https://github.com/honojs/hono/pull/2228JwtTokenInvalid object as cause when JWT is invalid https://github.com/honojs/hono/pull/2448verifyToken option https://github.com/honojs/hono/pull/2449verifyUser option https://github.com/honojs/hono/pull/2450extentionMap by @watany-dev in https://github.com/honojs/hono/pull/2382payload by @nakasyou in https://github.com/honojs/hono/pull/2424vary header in cache middleware by @naporin0624 in https://github.com/honojs/hono/pull/2426crypto if not exist by @yusukebe in https://github.com/honojs/hono/pull/2445alg option value by @yusukebe in https://github.com/honojs/hono/pull/2446; by @yusukebe in https://github.com/honojs/hono/pull/2447JwtTokenInvalid object as cause when JWT is invalid by @yusukebe in https://github.com/honojs/hono/pull/2448verifyToken option by @yusukebe in https://github.com/honojs/hono/pull/2449verifyUser option by @yusukebe in https://github.com/honojs/hono/pull/2450Full Changelog: https://github.com/honojs/hono/compare/v4.1.7...v4.2.0
Nothing published for this version
fix(cache): check globalThis.caches by @yusukebe in https://github.com/honojs/hono/pull/2444
globalThis.caches by @yusukebe in https://github.com/honojs/hono/pull/2444Full Changelog: https://github.com/honojs/hono/compare/v4.1.6...v4.1.7
chore(benchmark): add "loop" script by @yusukebe in https://github.com/honojs/hono/pull/2431
caches is not defined by @yusukebe in https://github.com/honojs/hono/pull/2443Full Changelog: https://github.com/honojs/hono/compare/v4.1.5...v4.1.6
perf: Don't use Arrap.prototype.map if it is not needed return value by @nakasyou in https://github.com/honojs/hono/pull/2419
Arrap.prototype.map if it is not needed return value by @nakasyou in https://github.com/honojs/hono/pull/2419await cached contents by @yusukebe in https://github.com/honojs/hono/pull/2430Full Changelog: https://github.com/honojs/hono/compare/v4.1.4...v4.1.5
fix(jsx): allow null, undefined, and boolean as children by @usualoma in https://github.com/honojs/hono/pull/2394
Full Changelog: https://github.com/honojs/hono/compare/v4.1.3...v4.1.4
fix(deno): export jwt helpers for Deno in src/helper.ts by @yusukebe in https://github.com/honojs/hono/pull/2385
src/helper.ts by @yusukebe in https://github.com/honojs/hono/pull/2385json and form validation by @yusukebe in https://github.com/honojs/hono/pull/2392Full Changelog: https://github.com/honojs/hono/compare/v4.1.2...v4.1.3
feat(utils/cookie): Typesafe cookie options by @Jxck in https://github.com/honojs/hono/pull/2350
slice + indexOf for getPath() by @yusukebe in https://github.com/honojs/hono/pull/2376MergePath merge blank paths correctly by @yusukebe in https://github.com/honojs/hono/pull/2365Full Changelog: https://github.com/honojs/hono/compare/v4.1.1...v4.1.2
fix(context): export ExecutionContext from hono by @yusukebe in https://github.com/honojs/hono/pull/2346
ExecutionContext from hono by @yusukebe in https://github.com/honojs/hono/pull/2346denoify by @yusukebe in https://github.com/honojs/hono/pull/2362true by @yusukebe in https://github.com/honojs/hono/pull/2363this.#headers by @yusukebe in https://github.com/honojs/hono/pull/2364Full Changelog: https://github.com/honojs/hono/compare/v4.1.0...v4.1.1
Hono v4.1.0 is now available! Let's take a look at the new features.
Hono v4.1.0 is now available! Let's take a look at the new features.
Now Hono supports WebSockets! With WebSocket helper, you can easily handle WebSockets in your application. Currently, Cloudflare Workers / Pages, Deno, and Bun adapters are available.
const app = new Hono()
app.get(
'/ws',
upgradeWebSocket((c) => {
return {
onMessage(event, ws) {
console.log(`Message from client: ${event.data}`)
ws.send('Hello from server!')
},
onClose: () => {
console.log('Connection closed')
}
}
})
)
PRC mode is now also supported for WebSockets endpoints. The following is a demo.
Thanks @nakasyou!
Introducing Body Limit Middleware. This middleware can limit the file size of the request body.
const app = new Hono()
app.post(
'/upload',
bodyLimit({
maxSize: 50 * 1024, // 50kb
onError: (c) => {
return c.text('overflow :(', 413)
}
}),
async (c) => {
const body = await c.req.parseBody()
if (body['file'] instanceof File) {
console.log(`Got file sized: ${body['file'].size}`)
}
return c.text('pass :)')
}
)
Thanks @EdamAme-x and @usualoma!
We made the target in the tsconfig.json as ES2022 instead of ES2020. So, the generated JavaScript files are now ES2022. That made the file size smaller! The following is the result of the minify and build of "Hello World" with Wrangler.
// ES2020
hono => Total Upload: 20.15 KiB / gzip: 7.42 KiB
hono/tiny => Total Upload: 12.74 KiB / gzip: 4.69 KiB
// ES2022
hono => Total Upload: 18.46 KiB / gzip: 7.09 KiB
hono/tiny => Total Upload: 11.12 KiB / gzip: 4.38 KiB
Performance has also been improved in some Node.js environments.
__Secure- and __Host- prefix https://github.com/honojs/hono/pull/2269cause option https://github.com/honojs/hono/pull/2224NO_COLOR https://github.com/honojs/hono/pull/2228NO_COLOR by @ryuapp in https://github.com/honojs/hono/pull/2228@hono/node-server by @yusukebe in https://github.com/honojs/hono/pull/2323bodyLimit for Deno by @yusukebe in https://github.com/honojs/hono/pull/2324Full Changelog: https://github.com/honojs/hono/compare/v4.0.10...v4.1.0
Nothing published for this version
fix (jsx/dom): keep ref.current value during lifecycle. by @usualoma in https://github.com/honojs/hono/pull/2307
Full Changelog: https://github.com/honojs/hono/compare/v4.0.9...v4.0.10
fix(stream): remove async from onabort by @sor4chi in https://github.com/honojs/hono/pull/2293
{} instead of Partial by @yusukebe in https://github.com/honojs/hono/pull/2305Full Changelog: https://github.com/honojs/hono/compare/v4.0.8...v4.0.9
fix(ssg): allow app: Hono for toSSG by @yusukebe in https://github.com/honojs/hono/pull/2272
app: Hono<any, any, any> for toSSG by @yusukebe in https://github.com/honojs/hono/pull/2272Full Changelog: https://github.com/honojs/hono/compare/v4.0.7...v4.0.8
fix(jsx/dom): import from correct file for avoiding circular dependency by @usualoma in https://github.com/honojs/hono/pull/2268
MergeSchemaPath supports regexp path params by @yusukebe in https://github.com/honojs/hono/pull/2271Full Changelog: https://github.com/honojs/hono/compare/v4.0.6...v4.0.7
chore: use official deno installer by @ryuapp in https://github.com/honojs/hono/pull/2250
Full Changelog: https://github.com/honojs/hono/compare/v4.0.5...v4.0.6
fix: Dot-containing paths do not correctly receive extension completion. by @watany-dev in https://github.com/honojs/hono/pull/2243
Full Changelog: https://github.com/honojs/hono/compare/v4.0.4...v4.0.5
docs(contribution): add install flag --frozen-lockfile by @ryuapp in https://github.com/honojs/hono/pull/2229
--frozen-lockfile by @ryuapp in https://github.com/honojs/hono/pull/2229@edge for compute by @yusukebe in https://github.com/honojs/hono/pull/2235Full Changelog: https://github.com/honojs/hono/compare/v4.0.3...v4.0.4
fix(jsx-renderer): support async component by @yusukebe in https://github.com/honojs/hono/pull/2211
Full Changelog: https://github.com/honojs/hono/compare/v4.0.2...v4.0.3
This is a patch release. But, it includes a minor feature.
This is a patch release. But, it includes a minor feature.
SSG helper now generates HTML files only if they are handling GET or ALL methods.
createHandler Response Types (handler x1) by @nakasyou in https://github.com/honojs/hono/pull/2192c.env variables to disable/enable SSG by @usualoma in https://github.com/honojs/hono/pull/2179Full Changelog: https://github.com/honojs/hono/compare/v4.0.1...v4.0.2
fix(context): remove duplicate definition of render method by @usualoma in https://github.com/honojs/hono/pull/2191
Full Changelog: https://github.com/honojs/hono/compare/v4.0.0...v4.0.1
Hono v4.0.0 is out! This major update includes some breaking changes and the addition of three major features.
Going to full-stack.
Hono v4.0.0 is out! This major update includes some breaking changes and the addition of three major features.
So Hono is going to full-stack. Let's take a look at the three features.
We introduce SSG Helper. With it you can generate static pages of your Hono applications.
To use this, create a separate file build.ts from the application and call the toSSG() function in it.
import fs from 'node:fs/promises'
import { toSSG } from 'hono/ssg'
import app from './src/index'
toSSG(app, fs)
There are adapters for Bun and Deno, so you can write shorter for Bun, for example.
import { toSSG } from 'hono/bun'
import app from './src/index'
toSSG(app)
And, just run it.
bun ./build.ts
Then HTML is generated.
$ ls static
about.html index.html
You can easily deploy this page to Cloudflare Pages, etc.
$ wrangler pages deploy static
We have created a plugin @hono/vite-ssg for Vite. By using this, you will be able to develop and build a static sites with just the vite command.
The configuration is the following:
import build from '@hono/vite-ssg'
import devServer from '@hono/vite-dev-server'
import { defineConfig } from 'vite'
export default defineConfig({
plugins: [
build(),
devServer({
entry: 'src/index.tsx'
})
]
})
If you want to develope, just run the command:
vite
If you want to build, just run the command:
vite build
In combination with the deployment mentioned above to Cloudflare Pages, you can develop, SSG build, and deploy non-stop. And each of them is extremely fast (the video is 2x faster).
hono/jsx was originally designed to run server-side as an alternative to template engines such as Mustache. Server-side JSX is an interesting experiment, creating a new stack to combine with HTMX and Alpine.js. But that's not all.
Now, hono/jsx runs on the client as well. We call it hono/jsx/dom or Client Components.
The exact same code as React runs with Hono's JSX.
import { useState } from 'hono/jsx'
import { render } from 'hono/jsx/dom'
function Counter() {
const [count, setCount] = useState(0)
return (
<div>
<p>Count: {count}</p>
<button onClick={() => setCount(count + 1)}>Increment</button>
</div>
)
}
function App() {
return (
<html>
<body>
<Counter />
</body>
</html>
)
}
const root = document.getElementById('root')
render(<App />, root)
The Hooks listed below are also implemented and you can create Client Components just like in React.
startViewTransition familyIn addition, the original APIs, startViewTransition family make the View Transition API easy to use.
import { useState, startViewTransition } from 'hono/jsx'
import { Style, css, keyframes } from 'hono/css'
const fadeIn = keyframes`
from { opacity: 0; }
to { opacity: 1; }
`
const App = () => {
const [showTitleImage, setShowTitleImage] = useState(false)
return (
<>
<button onClick={() => startViewTransition(() => setShowTitleImage((state) => !state))}>Click!</button>
<div>
{!showTitleImage ? (
<img src="https://hono.dev/images/logo.png" />
) : (
<div
class={css`
animation: ${fadeIn} 1s;
background: url('https://hono.dev/images/logo-large.png');
background-size: contain;
background-repeat: no-repeat;
background-position: center;
width: 500px;
height: 200px;
`}
/>
)}
</div>
</>
)
}
You can easily create the animation.
The hono/jsx/dom is fast and ultra-small. It has a smaller JSX runtime dedicated to the DOM in addition to the common server and client ones. Just specify hono/jsx/dom instead of hono/jsx in tsconfig.json.
"jsx": "react-jsx",
"jsxImportSource": "hono/jsx/dom"
The above counter example is 2.8KB with Brotli compression.
In comparison, React is 47.3 KB for the same thing.
Last is File-based Routing. This is not included in the hono package, but is provided in a separate package.
It is named HonoX.
HonoX has the following features.
You can try it now. One of create-hono's starter templates named "x-base" uses HonoX.
For detailed usage, please see the following HonoX repository.
https://github.com/honojs/honox
The addition of this feature has no impact on the core. "Hello World" in hono/tiny is still small, only 12KB minified.
'*' for app.use() - https://github.com/honojs/hono/pull/1753app.on supports multiple paths - https://github.com/honojs/hono/pull/1923c.json() - https://github.com/honojs/hono/pull/2021mimes option for serve-static - https://github.com/honojs/hono/pull/2094There are several breaking changes. Please see the Migration Guide below.
https://github.com/honojs/hono/blob/main/docs/MIGRATION.md
Thanks to all contributors. Great job on all the hard work!
app.on supports multiple paths by @yusukebe in https://github.com/honojs/hono/pull/1923import by @yusukebe in https://github.com/honojs/hono/pull/1969node:path by @nakasyou in https://github.com/honojs/hono/pull/1965deprecated from Factory and createHandlers by @yusukebe in https://github.com/honojs/hono/pull/1979manifest required by @yusukebe in https://github.com/honojs/hono/pull/1984.tsx by @yusukebe in https://github.com/honojs/hono/pull/1994c.get() inference by @yusukebe in https://github.com/honojs/hono/pull/1995ssgParams middleware by @nakasyou in https://github.com/honojs/hono/pull/1960isDynamicRoute and ssgParams matter by @yusukebe in https://github.com/honojs/hono/pull/2006useTransition() handling more simple by @usualoma in https://github.com/honojs/hono/pull/2003test:deno by @yusukebe in https://github.com/honojs/hono/pull/2014deno.lock by @yusukebe in https://github.com/honojs/hono/pull/2015return c.json() by @yusukebe in https://github.com/honojs/hono/pull/2021ssgParams flexibility by @sor4chi in https://github.com/honojs/hono/pull/2024BlankSchema or BlankInput by @yusukebe in https://github.com/honojs/hono/pull/2040useViewTransition() hook and viewTransition() helper by @usualoma in https://github.com/honojs/hono/pull/2053Installing dependencies by @yusukebe in https://github.com/honojs/hono/pull/2113mimes option for serve-static by @ryuapp in https://github.com/honojs/hono/pull/2094disableSSG and onlySSG by @yusukebe in https://github.com/honojs/hono/pull/2104c.var type by @Kyiro in https://github.com/honojs/hono/pull/2121hono/html by @javascripter in https://github.com/honojs/hono/pull/2143helper.ts by @yusukebe in https://github.com/honojs/hono/pull/2150MergeSchemePath infers param types correctly by @yusukebe in https://github.com/honojs/hono/pull/2152MergeSchemaPath infer inputs not only params by @yusukebe in https://github.com/honojs/hono/pull/2154getExtension() fast by @ryuapp in https://github.com/honojs/hono/pull/2168Full Changelog: https://github.com/honojs/hono/compare/v3.12.10...v4.0.0
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
fix(types): MergeSchemaPath infer inputs not only params by @yusukebe in https://github.com/honojs/hono/pull/2154
MergeSchemaPath infer inputs not only params by @yusukebe in https://github.com/honojs/hono/pull/2154Full Changelog: https://github.com/honojs/hono/compare/v3.12.11...v3.12.12
fix(html): Remove circular dependencies in hono/html by @javascripter in https://github.com/honojs/hono/pull/2143
hono/html by @javascripter in https://github.com/honojs/hono/pull/2143MergeSchemePath infers param types correctly by @yusukebe in https://github.com/honojs/hono/pull/2152Full Changelog: https://github.com/honojs/hono/compare/v3.12.10...v3.12.11
fix(trie-router): fix same parameter name issue by @yusukebe in https://github.com/honojs/hono/pull/2136
Full Changelog: https://github.com/honojs/hono/compare/v3.12.9...v3.12.10
chore: add development environment by @jarqvi in https://github.com/honojs/hono/pull/2095
curly rule as all by @yusukebe in https://github.com/honojs/hono/pull/2112Full Changelog: https://github.com/honojs/hono/compare/v3.12.8...v3.12.9
fix(factory): correct types inside of createMiddleware() by @yusukebe in https://github.com/honojs/hono/pull/2081
createMiddleware() by @yusukebe in https://github.com/honojs/hono/pull/2081Full Changelog: https://github.com/honojs/hono/compare/v3.12.7...v3.12.8
refactor: aws lambda createResult method by @ariskemper in https://github.com/honojs/hono/pull/2038
NO_COLOR by @ryuapp in https://github.com/honojs/hono/pull/2007env command by @ryuapp in https://github.com/honojs/hono/pull/2062Full Changelog: https://github.com/honojs/hono/compare/v3.12.6...v3.12.7
feat: Add Type to request for Lambda@Edge adapter to support S3 origin by @mosle in https://github.com/honojs/hono/pull/1991
c.json({}, requestInit) problem by @yusukebe in https://github.com/honojs/hono/pull/2025Full Changelog: https://github.com/honojs/hono/compare/v3.12.5...v3.12.6
fix(trie-router): fixed same name path params matter by @yusukebe in https://github.com/honojs/hono/pull/1992
Full Changelog: https://github.com/honojs/hono/compare/v3.12.4...v3.12.5
chore(package.json): use escape double quotes by @ryuapp in https://github.com/honojs/hono/pull/1957
Full Changelog: https://github.com/honojs/hono/compare/v3.12.3...v3.12.4
fix(context): set multiple cookies correctly in set res by @yusukebe in https://github.com/honojs/hono/pull/1947
set res by @yusukebe in https://github.com/honojs/hono/pull/1947ClientResponse and ClientRequest by @yusukebe in https://github.com/honojs/hono/pull/1952Full Changelog: https://github.com/honojs/hono/compare/v3.12.2...v3.12.3
fix(client): Fix issue awaiting RPC client by @codekrafter in https://github.com/honojs/hono/pull/1924
adapter/netlify/index.ts by @yusukebe in https://github.com/honojs/hono/pull/1932./netlify by @charkour in https://github.com/honojs/hono/pull/1930deno_dist/adapter/netlify by @charkour in https://github.com/honojs/hono/pull/1931Full Changelog: https://github.com/honojs/hono/compare/v3.12.1...v3.12.2
fix(jsx): fix jsx-runtime for falsy children by @usualoma in https://github.com/honojs/hono/pull/1910
c.req.valid() by @yusukebe in https://github.com/honojs/hono/pull/1914onAbort correctly by @sor4chi in https://github.com/honojs/hono/pull/1920Full Changelog: https://github.com/honojs/hono/compare/v3.12.0...v3.12.1
c.stream() is now deprecated and you should use stream() in Streaming Helper. And, stream.abort() has been added.
Hono v3.12.0 is now available! Let's take a look at the new features.
This release introduces CSRF Protection Middleware. It is easy to use and can prevent CSRF attacks by simply writing like the following:
import { csrf } from 'hono/csrf'
// ...
app.use('*', csrf())
CSRF Protection Middleware compares the Origin header value with the request URL. This is the same method used by SvelteKit and is valid in many situations except when using older browsers.
Thanks to @usualoma! And, the original idea for CSRF Protection was suggested by @htunnicliff. Thanks!
We created a built-in CSS in JS(X). It's "hono/css".
The css helper can be used with JSX. You can write the CSS in a css template literal tag and specify the returned value as the class value and it will be applied to that element.
app.get('/', (c) => {
const headerClass = css`
background-color: orange;
color: white;
padding: 1rem;
`
return c.html(
<html>
<head>
<Style />
</head>
<body>
<h1 class={headerClass}>Hello!</h1>
</body>
</html>
)
})
If you use VS Code, you can use vscode-styled-components for Syntax highlighting and IntelliSense for css tagged literals.
By combining keyframes and JSX rendering, you can create a like button without JavaScript!
Also, you can use a CSS-generating design tool such as Figma to create components even if you are not a CSS guru.
You can use other CSS in JS libraries in Hono, such as Panda CSS. However, hono/css can be used by simply importing the hono package, and Async components and Suspense are also supported.
Thanks to @usualoma!
stream.onAbort()c.stream() is now deprecated and you should use stream() in Streaming Helper. And, stream.abort() has been added.
app.get('/stream', (c) => {
return stream(c, async (stream) => {
stream.onAbort(() => {
console.log('Aborted!')
})
// ...
})
})
Thanks to @sor4chi!
onNotFound option for serveStaticCloudflare Workers, Deno, and Bun serveStatic now have an onNotFound option. You can write a handle when a file is not found.
app.get(
'/static/*',
serveStatic({
onNotFound: (path, c) => {
console.log(`${path} is not found, you access ${c.req.path}`)
}
})
)
Thanks to @Th1nkK1D!
colorize option for showRoutes()The colorize option has been added to the showRoutes function in hono/dev. If you set this value to false, the output will not be colored, which can be used when you want to log output, etc.
import { showRoutes } from 'hono/dev'
showRoutes(app, {
colorize: false
})
getRouterName()$url()c.stream* to helper by @sor4chi in https://github.com/honojs/hono/pull/1846getRouterName() by @yusukebe in https://github.com/honojs/hono/pull/1841onNotFound handler in adapters' serveStatic by @Th1nkK1D in https://github.com/honojs/hono/pull/1825colorize option for showRoutes() by @yusukebe in https://github.com/honojs/hono/pull/1886param option to $url() by @yusukebe in https://github.com/honojs/hono/pull/1885Full Changelog: https://github.com/honojs/hono/compare/v3.11.12...v3.12.0
fix(dev): preserve original handler in [composedHandler]. by @usualoma in https://github.com/honojs/hono/pull/1873
JSONParsed supports interface and Date etc. by @yusukebe in https://github.com/honojs/hono/pull/1853Full Changelog: https://github.com/honojs/hono/compare/v3.11.11...v3.11.12
Refactor(test): update vitest settings by @watany-dev in https://github.com/honojs/hono/pull/1851
ClientResponse by @yusukebe in https://github.com/honojs/hono/pull/1861req.queries() receives unexpected values by @yusukebe in https://github.com/honojs/hono/pull/1862Full Changelog: https://github.com/honojs/hono/compare/v3.11.10...v3.11.11
fix(trie-router): pass params to the next node by @yusukebe in https://github.com/honojs/hono/pull/1852
Full Changelog: https://github.com/honojs/hono/compare/v3.11.9...v3.11.10
Use vitest for fastly compute testing by @ysugimoto in https://github.com/honojs/hono/pull/1828
ts-jest by @yusukebe in https://github.com/honojs/hono/pull/18291.0.18 by @yusukebe in https://github.com/honojs/hono/pull/1832onError and notFound as class field by @yusukebe in https://github.com/honojs/hono/pull/1839Full Changelog: https://github.com/honojs/hono/compare/v3.11.8...v3.11.9
chore: bump devDependencies by @yusukebe in https://github.com/honojs/hono/pull/1820
devDependencies by @yusukebe in https://github.com/honojs/hono/pull/1820tsconfig.json): use vitest/globals for types by @yusukebe in https://github.com/honojs/hono/pull/1819Full Changelog: https://github.com/honojs/hono/compare/v3.11.7...v3.11.8
This release includes a security patch that fixes the vulnerability in TrieRouter.
This release includes a security patch that fixes the vulnerability in TrieRouter.
If you are using the default preset or hono/quick, or specifying the router as TrieRouter, you must upgrade to this version 3.11.7 immediately.
Just increment the version specifier to v3.11.7.
import { Hono } from 'https://deno.land/x/hono@v3.11.7/mod.ts'
import { serveStatic } from 'https://deno.land/x/hono@v3.11.7/middleware.ts'
Upgrade the hono package via npm:
npm install hono
// OR
yarn add hono
// OR
pnpm up hono
You may not update the hono package with npm update, so please use npm install.
The clients may override named path parameter values from previous requests if the application is using TrieRouter. So, there is a risk that a privileged user may use unintended parameters when deleting REST API resources.
TrieRouter is used either explicitly or when the application matches a pattern that is not supported by the default RegExpRouter.
The advisory: https://github.com/honojs/hono/security/advisories/GHSA-f6gv-hh8j-q8vq
If you discover such a vulnerability, please contact us immediately. We will respond immediately; we have enabled GitHub's private vulnerability reporting feature, so please use that.
https://github.com/honojs/hono/security/advisories
Thanks.
Full Changelog: https://github.com/honojs/hono/compare/v3.11.6...v3.11.7
fix(context): set status correctly by @yusukebe in https://github.com/honojs/hono/pull/1814
status correctly by @yusukebe in https://github.com/honojs/hono/pull/1814Full Changelog: https://github.com/honojs/hono/compare/v3.11.5...v3.11.6
fix(context): set headers values correctly by @yusukebe in https://github.com/honojs/hono/pull/1808
hono/tiny size by @ryuapp in https://github.com/honojs/hono/pull/1809c.json() allows object and returns JSONParsed<T> by @yusukebe in https://github.com/honojs/hono/pull/1806Full Changelog: https://github.com/honojs/hono/compare/v3.11.4...v3.11.5
fix(client): c.json() supports undefined/null response by @yusukebe in https://github.com/honojs/hono/pull/1794
c.json() supports undefined/null response by @yusukebe in https://github.com/honojs/hono/pull/1794Full Changelog: https://github.com/honojs/hono/compare/v3.11.3...v3.11.4
fix(base): name private _basePath instead of #basePath by @yusukebe in https://github.com/honojs/hono/pull/1785
private _basePath instead of #basePath by @yusukebe in https://github.com/honojs/hono/pull/1785ClientResponse.json() returns Union correctly by @yusukebe in https://github.com/honojs/hono/pull/1786Full Changelog: https://github.com/honojs/hono/compare/v3.11.2...v3.11.3
fix(types): Added E env type argument to showRoutes & inspectRoutes hono parameter by @NuroDev in https://github.com/honojs/hono/pull/1778
E env type argument to showRoutes & inspectRoutes hono parameter by @NuroDev in https://github.com/honojs/hono/pull/1778Full Changelog: https://github.com/honojs/hono/compare/v3.11.1...v3.11.2
fix(context): Strict type checking c.json() by @yusukebe in https://github.com/honojs/hono/pull/1776
c.json() by @yusukebe in https://github.com/honojs/hono/pull/1776Full Changelog: https://github.com/honojs/hono/compare/v3.11.0...v3.11.1
app.showRoutes has been deprecated.
Hono v3.11.0 is now available! Let's take a look at the new features.
ErrorBoundaryThis release introduces the new JSX component ErrorBoundary. It allows you to catch errors in child components.
For instance, in the example below, it will display the content specified in fallback if an error occurs.
import { ErrorBoundary } from 'hono/jsx'
// ...
function SyncComponent() {
throw new Error('Error')
return <div>Hello</div>
}
app.get('/sync', async (c) => {
return c.html(
<html>
<body>
<ErrorBoundary fallback={<div>Out of Service</div>}>
<SyncComponent />
</ErrorBoundary>
</body>
</html>
)
})
ErrorBoundary can be used with asynchronous components and Suspense as well.
async function AsyncComponent() {
await new Promise((resolve) => setTimeout(resolve, 2000))
throw new Error('Error')
return <div>Hello</div>
}
app.get('/with-suspense', async (c) => {
return c.html(
<html>
<body>
<ErrorBoundary fallback={<div>Out of Service</div>}>
<Suspense fallback={<div>Loading...</div>}>
<AsyncComponent />
</Suspense>
</ErrorBoundary>
</body>
</html>
)
})
Thanks to @usualoma!
createFactory() and createHandlers()The Factory helper now provides createFactory(), which creates an instance of the Factory class.
import { createFactory } from 'hono/factory'
const factory = createFactory()
createHandlers() in a Factory class instance assists in defining handlers.
import { createFactory } from 'hono/factory'
import { logger } from 'hono/logger'
// ...
const factory = createFactory<Env>()
const middleware = factory.createMiddleware(async (c, next) => {
c.set('foo', 'bar')
await next()
})
const handlers = factory.createHandlers(logger(), middleware, (c) => {
return c.json(c.var.foo)
})
app.get('/api', ...handlers)
Dev Helper is now available.
Instead of using app.showRoutes(), the showRoutes() function exported from hono/dev will display the registered routes in your console.
Consider an application like the following:
import { showRoutes } from 'hono/dev'
// ...
const app = new Hono().basePath('/v1')
app.get('/posts', (c) => {
// ...
})
app.get('/posts/:id', (c) => {
// ...
})
app.post('/posts', (c) => {
// ...
})
showRoutes(app)
When this application starts, the routes will be displayed in your console as follows:
GET /v1/posts
GET /v1/posts/:id
POST /v1/posts
Thanks to @usualoma!
app.showRoutes has been deprecated.
c.json() supports RPCc.json() now supports RPC, meaning you no longer need to use c.jsonT() for RPC-mode.
c.jsonT() has been deprecated.
Thanks to @usualoma!
c.req.routePathYou can retrieve the registered path within the handler as shown below:
app.get('/posts/:id', (c) => {
return c.json({ path: c.req.routePath })
})
If you access /posts/123, it will return /posts/:id:
{ "path": "/posts/:id" }
Thanks to @usualoma!
ErrorBoundary component by @usualoma in https://github.com/honojs/hono/pull/1714createFactory() and createHandlers() by @yusukebe in https://github.com/honojs/hono/pull/1743experimental from c.render/c.setRenderer() by @yusukebe in https://github.com/honojs/hono/pull/1748bearerAuth to accept a list of token strings by @mstibbard in https://github.com/honojs/hono/pull/1749inspectRoutes() and showRoutes() by @usualoma in https://github.com/honojs/hono/pull/1716Env types with changed routes by @yusukebe in https://github.com/honojs/hono/pull/1757MESSAGE_MATCHER_IS_ALREADY_BUILT by @yusukebe in https://github.com/honojs/hono/pull/1763c.json() have a type equivalent to c.jsonT() by @usualoma in https://github.com/honojs/hono/pull/1728matchedRoutes and routePath for HonoRequest by @usualoma in https://github.com/honojs/hono/pull/1744ErrorBoundary as experimental by @yusukebe in https://github.com/honojs/hono/pull/1771createHandlers by @yusukebe in https://github.com/honojs/hono/pull/1772# for private properties by @yusukebe in https://github.com/honojs/hono/pull/1762Full Changelog: https://github.com/honojs/hono/compare/v3.10.5...v3.11.0
fix(client): Allow optional props in JSON response by @yusukebe in https://github.com/honojs/hono/pull/1769
Full Changelog: https://github.com/honojs/hono/compare/v3.10.4...v3.10.5
fix(context): Set content-type with c.text() correctly by @yusukebe in https://github.com/honojs/hono/pull/1761
content-type with c.text() correctly by @yusukebe in https://github.com/honojs/hono/pull/1761Full Changelog: https://github.com/honojs/hono/compare/v3.10.3...v3.10.4
chore: remove jest.config.js by @yusukebe in https://github.com/honojs/hono/pull/1731
jest.config.js by @yusukebe in https://github.com/honojs/hono/pull/1731Path=/ for setCookie()/setSignedCookie() by @yusukebe in https://github.com/honojs/hono/pull/1742Full Changelog: https://github.com/honojs/hono/compare/v3.10.2...v3.10.3
One column per quarter.