2 ms·
Yes I think the IIFE is there to avoid the inner loop blocking the outer loop. I think it looks better with the IIFE factored out into its own function:
by maddyboo 5y ago
Yes I think the IIFE is there to avoid the inner loop blocking the outer loop.
I think it looks better with the IIFE factored out into its own function:
async function serve(conn) {
for await (const { respondWith } of Deno.serveHttp(conn)) {
respondWith(new Response("Hello World"));
}
}
for await (const conn of Deno.listen({ port: 4500 })) {
serve(conn);
}