summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--http_bench.ts15
-rw-r--r--http_test.ts22
2 files changed, 15 insertions, 22 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();
diff --git a/http_test.ts b/http_test.ts
deleted file mode 100644
index b0007a892..000000000
--- a/http_test.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import { serve } from "./http.ts";
-//import { test } from "https://deno.land/x/testing/testing.ts";
-
-const addr = "0.0.0.0:8000";
-const s = serve(addr);
-console.log(`listening on http://${addr}/`);
-
-const body = new TextEncoder().encode("Hello World\n");
-
-async function main() {
- for await (const req of s) {
- await req.respond({ status: 200, body });
- }
-}
-
-main();
-
-/*
-test(function basic() {
- console.log("ok");
-});
- */