summaryrefslogtreecommitdiff
path: root/std/examples/echo_server.ts
blob: 3bed1bca2e36e26f9c2ef9836a27586611269cfd (plain)
1
2
3
4
5
6
7
8
9
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
const hostname = "0.0.0.0";
const port = 8080;
const listener = Deno.listen({ hostname, port });
console.log(`Listening on ${hostname}:${port}`);
while (true) {
  const conn = await listener.accept();
  Deno.copy(conn, conn);
}