summaryrefslogtreecommitdiff
path: root/http/http_bench.ts
diff options
context:
space:
mode:
authorAndy Hayden <andyhayden1@gmail.com>2019-01-12 13:50:04 -0800
committerRyan Dahl <ry@tinyclouds.org>2019-01-12 16:50:04 -0500
commitf626b04ebe320a96a220af29595c6ca84cf9a10a (patch)
treeea059a796fed0650060398a8d347ae001d6f621c /http/http_bench.ts
parent7d6a0f64f20004f89f5e2cbfcf7941f0a8dafd21 (diff)
Reorgnanize repos, examples and tests (denoland/deno_std#105)
Original: https://github.com/denoland/deno_std/commit/c5e6e015b5be19027f60c19ca86283d12f9258f3
Diffstat (limited to 'http/http_bench.ts')
-rw-r--r--http/http_bench.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/http/http_bench.ts b/http/http_bench.ts
new file mode 100644
index 000000000..5aca12f55
--- /dev/null
+++ b/http/http_bench.ts
@@ -0,0 +1,15 @@
+import * as deno from "deno";
+import { serve } from "./mod.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();