For most developers,
workbox-sw will be all your service worker needs to handle routing
workbox-sw handles both precaching (using a manifest generated by
workbox-build), and runtime
The example service worker for this page precaches a single file, and then sets up a number of runtime caching routes that will match requests made against various endpoints and for local files.
You can see the effect of the service worker by trying out the following:
to see how precached assets are served.
to see a RegExp route in action.
to demonstrate that requests which aren't matched by a route default to going against the network.
to see how a network-first strategey can have a maximum timeout, after which a previously cached response is used.
demonstrates cache expiration by fetching one of three sequential images, when the maximum cache size is two.