Deno standard library
Go to Latest
function serveTls
import { serveTls } from "";

Serves HTTPS requests with the given handler.

You must specify keyFile and certFile options.

You can specifies addr option, which is the address to listen on, in the form "host:port". The default is "".

The below example serves with the default port 8443.

import { serveTls } from "";
const certFile = "/path/to/certFile.crt";
const keyFile = "/path/to/keyFile.key";
console.log("server is starting at https://localhost:8443");
serveTls((_req) => new Response("Hello, world"), { certFile, keyFile });


handler: Handler[src]

The handler for individual HTTPS requests.

options: ServeTlsInit[src]

The options. See ServeTlsInit documentation for details.