summaryrefslogtreecommitdiff
path: root/http_test.ts
blob: b0007a89270af5426e59d8795f5ba73958683481 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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");
});
  */