hono 1.6.0-0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,8 +32,14 @@ app.fire()
|
|
|
32
32
|
- **Middleware** - built-in middleware and ability to extend with your own middleware.
|
|
33
33
|
- **TypeScript** - first-class TypeScript support.
|
|
34
34
|
- **Optimized** - for Cloudflare Workers.
|
|
35
|
+
- **Deno** - support for Deno (Experimental).
|
|
35
36
|
|
|
36
|
-
##
|
|
37
|
+
## Benchmarks
|
|
38
|
+
|
|
39
|
+
### Cloudflare Workers
|
|
40
|
+
|
|
41
|
+
- Machine: Apple MacBook Pro, 32 GiB, M1 Pro
|
|
42
|
+
- Scripts: [benchmarks/handle-event](https://github.com/honojs/hono/tree/master/benchmarks/handle-event)
|
|
37
43
|
|
|
38
44
|
**Hono is fastest**, compared to other routers for Cloudflare Workers.
|
|
39
45
|
|
|
@@ -47,6 +53,22 @@ Fastest is hono - regexp-router
|
|
|
47
53
|
✨ Done in 43.56s.
|
|
48
54
|
```
|
|
49
55
|
|
|
56
|
+
### Deno
|
|
57
|
+
|
|
58
|
+
- Machine: Apple MacBook Pro, 32 GiB, M1 Pro, Deno v1.22.0
|
|
59
|
+
- Scripts: [benchmarks/deno](https://github.com/honojs/hono/tree/master/benchmarks/deno)
|
|
60
|
+
- Method: `autocannon -c 100 -d 40 -p 10 'http://127.0.0.1:8000/user/lookup/username/foo'`
|
|
61
|
+
|
|
62
|
+
**Hono is fastest**, compared to other frameworks for Deno.
|
|
63
|
+
|
|
64
|
+
| Framework | Version | Results |
|
|
65
|
+
| ----------------------------- | :-----: | ----------------------------------------: |
|
|
66
|
+
| **Hono - RegExpRouter** | 1.6.0 | **5118k requests in 40.02s, 865 MB read** |
|
|
67
|
+
| **Hono - TriRouter(default)** | 1.6.0 | **4932k requests in 40.02s, 833 MB read** |
|
|
68
|
+
| Faster | 5.7 | 3579k requests in 40.02s, 551 MB read |
|
|
69
|
+
| oak | 10.5.1 | 2385k requests in 40.02s, 403 MB read |
|
|
70
|
+
| opine | 2.2.0 | 1491k requests in 40.02s, 346 MB read |
|
|
71
|
+
|
|
50
72
|
## Why so fast?
|
|
51
73
|
|
|
52
74
|
Routers used in Hono are really smart.
|
|
@@ -734,6 +756,34 @@ export default app
|
|
|
734
756
|
|
|
735
757
|
- Hono Examples - <https://github.com/honojs/examples>
|
|
736
758
|
|
|
759
|
+
## Deno
|
|
760
|
+
|
|
761
|
+
Hono also works with Deno. This feature is still experimental.
|
|
762
|
+
|
|
763
|
+
```tsx
|
|
764
|
+
/** @jsx jsx */
|
|
765
|
+
import { serve } from 'https://deno.land/std@0.146.0/http/server.ts'
|
|
766
|
+
import { Hono, logger, poweredBy, basicAuth, jsx } from 'https://deno.land/x/hono/mod.ts'
|
|
767
|
+
|
|
768
|
+
const app = new Hono()
|
|
769
|
+
|
|
770
|
+
app.use('*', logger(), poweredBy())
|
|
771
|
+
app.get(
|
|
772
|
+
'/auth/*',
|
|
773
|
+
basicAuth({
|
|
774
|
+
username: 'deno',
|
|
775
|
+
password: 'isacool',
|
|
776
|
+
})
|
|
777
|
+
)
|
|
778
|
+
|
|
779
|
+
app.get('/', (c) => {
|
|
780
|
+
return c.html(<h1>Hello Deno!</h1>)
|
|
781
|
+
})
|
|
782
|
+
app.get('/auth/abc', (c) => c.text('You are authorized'))
|
|
783
|
+
|
|
784
|
+
serve(app.fire())
|
|
785
|
+
```
|
|
786
|
+
|
|
737
787
|
## Related projects
|
|
738
788
|
|
|
739
789
|
Implementation of the original router `TrieRouter` is inspired by [goblin](https://github.com/bmf-san/goblin). `RegExpRouter` is inspired by [Router::Boom](https://github.com/tokuhirom/Router-Boom). API design is inspired by [express](https://github.com/expressjs/express) and [koa](https://github.com/koajs/koa). [itty-router](https://github.com/kwhitley/itty-router), [Sunder](https://github.com/SunderJS/sunder), and [worktop](https://github.com/lukeed/worktop) are the other routers or frameworks for Cloudflare Workers.
|