hono

Web framework built on Web Standards

MIT License

Downloads
1.4M
Stars
19K
Committers
192

Bot releases are hidden (Show)

hono - v4.2.9 Latest Release

Published by yusukebe 6 months ago

What's Changed

Full Changelog: https://github.com/honojs/hono/compare/v4.2.8...v4.2.9

hono - v4.2.8

Published by yusukebe 6 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/honojs/hono/compare/v4.2.7...v4.2.8

hono - v4.2.7

Published by yusukebe 6 months ago

hono - v4.2.6

Published by yusukebe 6 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/honojs/hono/compare/v4.2.5...v4.2.6

hono - v4.2.5

Published by yusukebe 6 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/honojs/hono/compare/v4.2.4...v4.2.5

hono - v4.2.4

Published by yusukebe 6 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/honojs/hono/compare/v4.2.3...v4.2.4

hono - v4.2.3

Published by yusukebe 6 months ago

What's Changed

Full Changelog: https://github.com/honojs/hono/compare/v4.2.2...v4.2.3

hono - v4.2.2

Published by yusukebe 7 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/honojs/hono/compare/v4.2.1...v4.2.2

hono - v4.2.1

Published by yusukebe 7 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/honojs/hono/compare/v4.2.0...v4.2.1

hono - v4.2.0

Published by yusukebe 7 months ago

Hono v4.2.0 is now available! Let's take a look at the new features.

Added more algorithms for JWT

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.

  • HS256
  • HS384
  • HS512
  • RS256
  • RS384
  • RS512
  • PS256
  • PS384
  • PS512
  • ES256
  • ES384
  • ES512
  • EdDSA

You can use these algorithms from the JWT middleware or JWT helpers. Thanks @Code-Hex!

Method Override Middleware

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

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!

Other features

All Updates

New Contributors

Full Changelog: https://github.com/honojs/hono/compare/v4.1.7...v4.2.0

hono -

Published by yusukebe 7 months ago

This is a pre-release.

hono - v4.1.7

Published by yusukebe 7 months ago

What's Changed

Full Changelog: https://github.com/honojs/hono/compare/v4.1.6...v4.1.7

hono - v4.1.6

Published by yusukebe 7 months ago

What's Changed

Full Changelog: https://github.com/honojs/hono/compare/v4.1.5...v4.1.6

hono - v4.1.5

Published by yusukebe 7 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/honojs/hono/compare/v4.1.4...v4.1.5

hono - v4.1.4

Published by yusukebe 7 months ago

What's Changed

Full Changelog: https://github.com/honojs/hono/compare/v4.1.3...v4.1.4

hono - v4.1.3

Published by yusukebe 7 months ago

What's Changed

Full Changelog: https://github.com/honojs/hono/compare/v4.1.2...v4.1.3

hono - v4.1.2

Published by yusukebe 7 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/honojs/hono/compare/v4.1.1...v4.1.2

hono - v4.1.1

Published by yusukebe 7 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/honojs/hono/compare/v4.1.0...v4.1.1

hono - v4.1.0

Published by yusukebe 7 months ago

Hono v4.1.0 is now available! Let's take a look at the new features.

WebSocket Helper

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.

WebSocket Helper

Thanks @nakasyou!

Body Limit Middleware

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!

ES2022

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.

SS

Other features

All Updates

New Contributors

Full Changelog: https://github.com/honojs/hono/compare/v4.0.10...v4.1.0

hono - v4.0.10

Published by yusukebe 8 months ago

What's Changed

Full Changelog: https://github.com/honojs/hono/compare/v4.0.9...v4.0.10

Package Rankings
Top 3.31% on Deno.land
Top 9.78% on Proxy.golang.org
Top 1.1% on Npmjs.org
Badges
Extracted from project README's
GitHub Workflow Status GitHub npm npm JSR Bundle Size Bundle Size GitHub commit activity GitHub last commit codecov Discord badge
Related Projects