|
|
|
|
|
by kentonv
1554 days ago
|
|
> I strongly believe that it'd be way better for their clients if the client could just do `export default async function handleDns(event) { ... }` I'm the tech lead of Cloudflare Workers and you're absolutely right about this. We actually introduced such a syntax as an option a while back and are encouraging people to move to it: https://blog.cloudflare.com/workers-javascript-modules/ Your argument is exactly one of the reasons for this. The more general version of the argument is that it enables composability: you can take a Worker implementation and incorporate it into a larger codebase without having to modify its code. This helps for testing (incorporating into a test harness), but also lets you do things like take two workers and combine them into one worker with a new top-level event handler that dispatches to one or the other. |
|