summaryrefslogtreecommitdiff
path: root/std/http/http_bench.ts
blob: 06043f9e4e82c53a413595b9cb904b7af2a6d196 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import { serve } from "./server.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> {
  console.log(`http://${addr}/`);
  for await (const req of server) {
    req.respond({ body });
  }
}

main();