v3.4.0 is out now! This release includes two significant new features.
Netlify Adapter
We're introducing the Netlify Adapter! With this adapter, you can run your Hono application on Netlify Edge Functions.
import { Hono } from 'https://deno.land/x/hono@v3.4.1/mod.ts'
import { prettyJSON } from 'https://deno.land/x/hono@v3.4.1/middleware.ts'
import { handle, type Env } from 'https://deno.land/x/hono@v3.4.1/adapter/netlify/mod.ts'
const app = new Hono<Env>()
app.get('/', prettyJSON(), (c) =>
c.json({
'You are in': c.env.context.geo.country?.name
})
)
export default handle(app)
You can try it with the create-hono
command:
npm create hono@latest my-app
Additionally, we now have 12 starter templates, ensuring that Hono runs on various platforms.
- aws-lambda
- bun
- cloudflare-pages
- cloudflare-workers
- deno
- fastly
- lagon
- lambda-edge
- netlify
- nextjs
- nodejs
- vercel
Hono really runs on every platforms.
Cookie Middleware supports Signed Cookies
Cookie Middleware now supports signed cookies. You can use getSignedCookie()
and setSignedCookie()
helper functions.
app.get('/signed-cookie', async (c) => {
const secret = 'secret ingredient'
const allSignedCookies = await getSignedCookie(c, secret)
const fortuneCookie = await getSignedCookie(c, secret, 'fortune_cookie')
// ...
const anotherSecret = 'secret chocolate chips'
await setSignedCookie(c, 'great_cookie', 'blueberry', anotherSecret)
deleteCookie(c, 'great_cookie')
//
})
Special thanks to @torte for this feature!
All Updates
- chore: tweak
jest.config.js
by @yusukebe in #1274 - refactor(hono-base): remove async/await from
app.request
by @yusukebe in #1275 - perf(utils/url): use regexp instead of
indexOf()
by @yusukebe in #1276 - doc: Adding a Supported Runtime - Lambda@Edge by @watany-dev in #1278
- test(app): add more tests for hostname-routing by @yusukebe in #1282
- fix(types): add a missing handler type by @yusukebe in #1283
- perf(context): add
init
flag by @yusukebe in #1284 - feat(middleware): Simple cookie signing functionality by @torte in #1279
- fix(adapter/aws-lambda): use content-encoding to determine isBase64Encoded by @if1live in #1295
- feat(parseBody): allow passing generics to
parseBody()
by @yusukebe in #1289 - feat(adapter): add Netlify adapter by @yusukebe in #1290
- docs(jsdoc): fix a
app.route()
JSDoc description by @yusukebe in #1296 - chore(benchmark): update the handle-event benchmark by @yusukebe in #1297
- refactor(app): add "deprecate message" for
app.handleEvent()
by @yusukebe in #1298 - fix(validator): support async validator func by @yusukebe in #1303
New Contributors
Full Changelog: v3.3.4...v3.4.0