An echo server is a simple network application that listens for incoming connections and requests, and then repeats back any data it receives from clients.
To test this example, try sending data to it with Netcat (Linux/MacOS only). For example, in your terminal run: echo 'Hello, Deno!' | nc localhost 8080
const listener = Deno.listen({ port: 8080 });
console.log("listening on 0.0.0.0:8080");for await (const conn of listener) {
conn.readable.pipeTo(conn.writable);
}Run this example locally using the Deno CLI:
deno run -N echo_server.ts