Match API routes with URLPattern in a Workers function
I was wiring a handful of API routes on a Cloudflare Worker and didn’t want a framework for it. I’d usually reach for a regex, or split the pathname and switch on segments. I didn’t know there was a web-standard way to do this, but there is! URLPattern matches parts of a URL with a syntax that looks a lot...