Lazy routers?
Hi, does hono support lazy routers? I made a really huge router with some heavy dependencies and now I'm getting spikes on cold starts
8 Replies
Not out of the box, but maybe you can try async imports within a “router of routers”.
I don't quite get the idea
Something like this?
App - Hono - Hono
Web framework built on Web Standards for Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, Node.js, and others. Fast, but not only fast.
To be honest, I don't get how is this method usefull in this context
May be I'm missing something?
Hono technically supports any kind of router, since you can provide a custom implementation for a router
But I don't know if making a lazy router is a great idea
Agree. Cold starts implies lambdalith -- it's probably better handled at the l7 layer (load balancer, api gw, cdn, etc).
@Gary, el Pingüino Artefacto just in case, have you tried using
hono/quick
?
https://hono.dev/docs/api/presets#hono-quickI'm only know the basic of hono, so no. I'm very new. I'll give it a shoot. Thanks dude!