honojs / website

Repository for hono.dev
https://hono.dev
68 stars 208 forks source link

Service worker documentation and example #291

Open mfulton26 opened 2 months ago

mfulton26 commented 2 months ago

From what I can tell, Hono can be used for an offline web app in a service worker (even hosted from a web server that only serves static assets).

Can that get officially documented and demonstrated through an example?

I found this, which is magical indeed, but I think a simpler example that doesn't use the same service worker between Cloudflare and browser but a simple browser example would be sufficient and beneficial (your magical example could be linked to it included too).

I think officially documenting on the site and linking to a Hono example in the example repo with other examples would help demonstrate that Hono really can be ran in most any JS runtime and that it can be used to power an offline only web app (installed while online but then requires no Internet connection for usage).

yusukebe commented 2 months ago

Hi @mfulton26

Great idea! I know some users use Hono inside a service worker in production. So it's not only for magic. I'd like to have it.

mfulton26 commented 2 months ago

I'm starting to look at HonoX too. I'd love to bundle Next.js / Remix / Deno Fresh like app routing into a service worker. If Honox targets multiple different JS runtimes like Hono (which I'm guessing it will as it appears to be built on top of Hono) then large, multi-route apps can be served from the edge and from service workers with high code reuse. Sounds amazing to me!