Skip to main content
Module

std/net/mod.ts>getAvailablePort

The Deno Standard Library
Go to Latest
function getAvailablePort
import { getAvailablePort } from "https://deno.land/std@0.223.0/net/mod.ts";

Returns an available network port.

Examples

Example 1

import { getAvailablePort } from "https://deno.land/std@0.223.0/net/get_available_port.ts";

const port = getAvailablePort();
Deno.serve({ port }, () => new Response("Hello, world!"));

Returns

number