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

x/ayonli_jsext/lib.deno.d.ts>Deno.listen

A JavaScript extension package for building strong and modern applications.
Latest
function Deno.listen
allow-net
allow-read
allow-write
import { Deno } from "https://deno.land/x/ayonli_jsext@v0.9.72/lib.deno.d.ts";
const { listen } = Deno;

Listen announces on the local transport address.

const listener1 = Deno.listen({ port: 80 })
const listener2 = Deno.listen({ hostname: "192.0.2.1", port: 80 })
const listener3 = Deno.listen({ hostname: "[2001:db8::1]", port: 80 });
const listener4 = Deno.listen({ hostname: "golang.org", port: 80, transport: "tcp" });

Requires allow-net permission.

Parameters

options: TcpListenOptions & { transport?: "tcp"; }

Listen announces on the local transport address.

const listener = Deno.listen({ path: "/foo/bar.sock", transport: "unix" })

Requires allow-read and allow-write permission.

Parameters

options: UnixListenOptions & { transport: "unix"; }