0

I've been trying to use the swtoolbox for service worker. There is the case i want to use the url pattern matching to make network only and cache only.

i'm still stuck to make it work.

Basic usage is working fine.

toolbox.router.get('/index.html', () => new Response('Test'));

When i started using the Regex. It's not working as expected.

toolbox.router.get('/.*(\.html$)/', () => new Response('Test'));

It would be nice if anyone tried doing that make it work. I had use to validate my Regex is working fine first there. https://regex101.com/

Winn Minn Soe
  • 341
  • 1
  • 2
  • 4

1 Answers1

0

found out that it assume as the string. I've to remove the single quote to run as the Regex.

toolbox.router.get(/.*(\.html$)/, () => new Response('Test'));
Winn Minn Soe
  • 341
  • 1
  • 2
  • 4