diff options
| author | Ryan Dahl <ry@tinyclouds.org> | 2018-11-08 15:03:45 -0500 |
|---|---|---|
| committer | Ryan Dahl <ry@tinyclouds.org> | 2018-11-08 15:07:37 -0500 |
| commit | 80b2067030abdf9f51b1d0eb9ceaaf76c2d09bfb (patch) | |
| tree | 28ac74d66c66bbf9e418e926dfed978919b81fb8 /http_test.ts | |
| parent | fb0b99408b1ce0c8061d654e9dae3fd8221efa6f (diff) | |
Use async iterators for http server.
Original: https://github.com/denoland/deno_std/commit/9377d154c5079a732d76a36a6ec5892d8da43087
Diffstat (limited to 'http_test.ts')
| -rw-r--r-- | http_test.ts | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/http_test.ts b/http_test.ts index 4a8867aba..1b16b0f0a 100644 --- a/http_test.ts +++ b/http_test.ts @@ -1,6 +1,21 @@ -//import { listen } from "./server.ts"; -import { test } from "https://deno.land/x/testing/testing.ts"; +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}/`); + +async function main() { + for await (const req of s) { + console.log("Req", req); + req.respond({ body: "Hello World\n" }); + } +} + +main(); + +/* test(function basic() { console.log("ok"); }); + */ |
