More than on worker in the same account?


#1

Hey there,

Can we able to run different worker script in the same file?

I’m trying to the mix these two scripts on one and run it.

https://github.com/vidaxl-com/cloudflare_webworkers/blob/master/examples/webp.js (webp conversion script)

https://raw.githubusercontent.com/cloudflare/worker-examples/master/examples/edge-cache-html/edge-cache-html.js (edge cache script)

Thanks


#2

I do something like this:

const parsedUrl = new URL(event.request.url);
let elements = parsedUrl.pathname.split('/').filter(n => n);
if (elements[0] === 'webp'){
// run a function
}