summaryrefslogtreecommitdiff
path: root/http_test.ts
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-11-09 17:23:01 -0500
committerRyan Dahl <ry@tinyclouds.org>2018-11-09 17:23:01 -0500
commit92455a0b67982bd28f23a09acb9e27dcb6f75e1d (patch)
tree5d9418ab1514528e48d009af5ed3f29ebbc3234f /http_test.ts
parent5880827f33ab90d4d5f5ac2f9166fddc76614cfa (diff)
Basic http demo working.
Original: https://github.com/denoland/deno_std/commit/805efdb7508f4b916645df49038b4c143c0de0a1
Diffstat (limited to 'http_test.ts')
-rw-r--r--http_test.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/http_test.ts b/http_test.ts
index 1b16b0f0a..b0007a892 100644
--- a/http_test.ts
+++ b/http_test.ts
@@ -5,10 +5,11 @@ 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) {
- console.log("Req", req);
- req.respond({ body: "Hello World\n" });
+ await req.respond({ status: 200, body });
}
}