npm hono 3.4.0
v3.4.0

latest releases: 4.6.9, 4.6.8, 4.6.7...
15 months ago

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.

  1. aws-lambda
  2. bun
  3. cloudflare-pages
  4. cloudflare-workers
  5. deno
  6. fastly
  7. lagon
  8. lambda-edge
  9. netlify
  10. nextjs
  11. nodejs
  12. 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

Don't miss a new hono release

NewReleases is sending notifications on new releases.