github honojs/hono v2.5.0

latest releases: v4.6.2, v4.6.1, v4.6.0...
22 months ago

Summary

There are three new features. All of them are useful to you.

1. c.runtime

You can know which runtime the code is running on with c.runtime. This is implemented by @yujong-lee. Thanks!

app.get('/which-runtime/*', (c) => {
  return c.text(`You are on ${c.runtime}!`)
})

2. app.showRoutes()

The app.showRoutes() shows the routes which are registered.

SS

3. app.on()

The app.on() function will enable us set the custom HTTP method as we like:

app.on('PURGE', '/foo', async (c) => {
  await purgeCache('foo')
  return c.redirect('/')
})

What's Changed

  • feat(context): Introducing c.runtime by @yujong-lee in #644
  • fix(type): make compatibility with @cloudflare/workers-types by @yusukebe in #645
  • refactor(types): reduce type definitions by @yusukebe in #649
  • fix(context): check cloudflare before checking node in c.runtime by @yusukebe in #651
  • fix(error): make notFound() enables to catch errors correctly by @yusukebe in #652
  • feat(app): introduce app.showRoutes() by @yusukebe in #650
  • feat(app): introduce app.on(method, path, handler) by @yusukebe in #653
  • fix(types): export ErrorHandler and NotFoundHandler by @yusukebe in #656

Full Changelog: v2.4.1...v2.5.0

Don't miss a new hono release

NewReleases is sending notifications on new releases.