This recipe shows a service worker acting like a remote server.
As an application developer, I want to to fully decouple UI from business logic.
With REST APIs you can decouple client from business logic. The business logic is actually a separated component placed on a remote server. With Service Workers you can do the same. Simply move your business logic to a Service Worker responding on fetch events.
The client code is virtually identical to that in the API analytics recipe (the report link has been removed). On the contrary, the remote Express server has been completely replaced by the ServiceWorkerWare worker.
Has it been useful?
Tell us what you think of this recipe by leaving a comment!