summaryrefslogtreecommitdiff
path: root/http_bench.ts
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-12-06 17:19:12 -0500
committerRyan Dahl <ry@tinyclouds.org>2018-12-06 17:19:34 -0500
commit16aedf68ea056c312edd8f857a57c143c4f21f50 (patch)
treee944e63165c6dc3a85d497680044268475fe7302 /http_bench.ts
parentc5871cb996d42eec2453b86003f305ec62ee3e46 (diff)
Add http_bench.ts
Original: https://github.com/denoland/deno_std/commit/82ceb596f3d1f75b1711117767e26cfac8b64945
Diffstat (limited to 'http_bench.ts')
-rw-r--r--http_bench.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/http_bench.ts b/http_bench.ts
new file mode 100644
index 000000000..9b4cff464
--- /dev/null
+++ b/http_bench.ts
@@ -0,0 +1,15 @@
+import * as deno from "deno";
+import { serve } from "https://deno.land/x/net/http.ts";
+
+const addr = deno.args[1] || "127.0.0.1:4500";
+const server = serve(addr);
+
+const body = new TextEncoder().encode("Hello World");
+
+async function main(): Promise<void> {
+ for await (const request of server) {
+ await request.respond({ status: 200, body });
+ }
+}
+
+main();