Hacker News new | ask | show | jobs
by hombre_fatal 416 days ago
Koa was next gen Express when TJ Hollowaychuk made it. Used first class promises to have real middleware like “response = await next()”

Hono is basically next gen Koa: zero dependencies and made to work in additional contexts like in CloudFlare Workers.

- Express deps: https://npmgraph.js.org/?q=express (lol)

- Hono deps: https://npmgraph.js.org/?q=hono

Node web servers are all so similar (you write ~identical code no matter which one you use) that tie-breaking on a dep diff this big is reasonable.

1 comments

In what way is Hono better than Koa? Any package can have zero dependencies if you just inline / bundle them in your package.
Trivial dependencies should be inlined. Consider leftPad or isEven.

Or these Koa deps:

- https://github.com/isaacs/inherits/blob/main/inherits.js

- https://github.com/component/toidentifier/blob/master/index....

When you're building a web server library, you need to care about supply chain attacks because you're the one exposing people to them.

Anyways, that's beside the point. Hono is what Koa should have been if Koa wasn't frozen 10 years ago: a simple `res = await handle(req)` abstraction that works everywhere including edge workers.

It was designed by cloduflare for serverless use. There's no dependency on node, as cloudflare is based on web standards, so it was designed around warper for browser-native js modules (Request, crypto, ... hence the low dependency), which is why it integrates well with bun and deno.