summaryrefslogtreecommitdiff
path: root/net/http_bench.ts
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-12-18 18:25:49 -0500
committerRyan Dahl <ry@tinyclouds.org>2018-12-18 18:27:05 -0500
commit968d50842512a007dc9c2e4ae31b1970fdc6e6a2 (patch)
tree240d8b019a6694b6722ea4cfc3576e3f5b1b4bd0 /net/http_bench.ts
parent6e077e71fa27dbb993a49cda211c5385a76ca6aa (diff)
Rename project to deno_std
Move typescript files to net/ Original: https://github.com/denoland/deno_std/commit/99e276eb89fbe0003bfa8d9e7b907ff3ef19ee47
Diffstat (limited to 'net/http_bench.ts')
-rw-r--r--net/http_bench.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/net/http_bench.ts b/net/http_bench.ts
new file mode 100644
index 000000000..8e1e24ad6
--- /dev/null
+++ b/net/http_bench.ts
@@ -0,0 +1,15 @@
+import * as deno from "deno";
+import { serve } from "./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();