title: Migrate Google Workbox setDefaultHandler // setCatchHandler from v2 to v3
body: <p>I'm trying to migrate my old code from google workbox v2 to workbox v3, and i can't use <code>workbox.routing.registerNavigationRoute</code> because my default route '/' (which is where my appshell is) is a <strong>runtime cache</strong> (because it's for a multilingual website <a href="https://www.autovisual.com" rel="nofollow noreferrer">https://www.autovisual.com</a> with languages put in subfolder '/fr', '/es' ... with a unique Service-Worker scoped at '/').</p>
  
  <p>This is the v2 code :</p>
  
  <pre><code>workboxSW.router.setDefaultHandler({
      handler: ({
          event
      }) =&gt; {
          return fetch(event.request);
      }
   });
  
  workboxSW.router.setCatchHandler({
      handler: ({
          event
      }) =&gt; {
          if (event.request.mode === 'navigate') {
              return caches.match('/');
          }
          return new Response();
      }
  });
  </code></pre>
  
  <p>It seems pretty basic : the goal is to catch all request 'navigate' that didn't match any other route and send the cached version, network first, of the url '/'.</p>
  
  <p>For the info in the client js i use : </p>
  
  <pre><code>if ('serviceWorker' in navigator) {
      window.addEventListener('load', function() {
          caches.open('rootCacheNetworkFirst').then(function(cache) {
              cache.match('/').then(function(response) {
                  if (!response) {
                      cache.add('/');
                  }
              });
          });
  
          navigator.serviceWorker.register('/sw.js', {
              scope: "/"
          });
      });
  }
  </code></pre>
  
  <p>I can't find any example with the new v3 <code>workbox.routing.setDefaultHandler</code> and <code>workbox.routing.setCatchHandler</code> and i'm stuck :(</p>