Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

std/net/mod.ts>getAvailablePort

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

Returns an available network port.

Examples

Example 1

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

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

Parameters

optional
options: GetAvailablePortOptions

Returns

number