website icon indicating copy to clipboard operation
website copied to clipboard

Service worker documentation and example

Open mfulton26 opened this issue 10 months ago • 2 comments

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).

mfulton26 avatar Apr 05 '24 13:04 mfulton26

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.

yusukebe avatar Apr 06 '24 11:04 yusukebe

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!

mfulton26 avatar Apr 06 '24 19:04 mfulton26

Now, we have Service Worker Adapter and the document on our website:

https://hono.dev/docs/getting-started/service-worker

We can close this issue!

yusukebe avatar Aug 18 '24 00:08 yusukebe