From 4ef08a58dfbcf893f25fd59917aa946f455e85f2 Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Wed, 24 Aug 2022 00:08:56 +0200 Subject: feat: update `Deno.serve` function signature (#15563) This commit changes the `Deno.serve` function signature to be more versatile and easier to use. It is now a drop in replacement for std/http's `serve`. The input validation has also been reworked. --- cli/bench/http/deno_flash_send_file.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cli/bench/http/deno_flash_send_file.js') diff --git a/cli/bench/http/deno_flash_send_file.js b/cli/bench/http/deno_flash_send_file.js index 81e8c4991..db2ad7a82 100644 --- a/cli/bench/http/deno_flash_send_file.js +++ b/cli/bench/http/deno_flash_send_file.js @@ -6,9 +6,9 @@ const { serve } = Deno; const path = new URL("../testdata/128k.bin", import.meta.url).pathname; -function fetch() { +function handler() { const file = Deno.openSync(path); return new Response(file.readable); } -serve({ fetch, hostname, port: Number(port) }); +serve(handler, { hostname, port: Number(port) }); -- cgit v1.2.3