Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

std/examples/echo_server.ts

Deno standard library
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
File
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
/** A simple echo server which listens on port `:8080`. * * @module */
import { copy } from "../streams/conversion.ts";
const hostname = "0.0.0.0";const port = 8080;const listener = Deno.listen({ hostname, port });
console.log(`Listening on http://localhost:${port}`);
for await (const conn of listener) { copy(conn, conn);}