Skip to main content
Module

x/http_fns/secure_localhost.ts>loadKeyAndCert

A bunch of functions for building HTTP servers
Go to Latest
function loadKeyAndCert
import { loadKeyAndCert } from "https://deno.land/x/http_fns@v0.0.27/secure_localhost.ts";

Allow serving over HTTPS on localhost, by load the TLS key and certificate for localhost from the files localhost-key.pem and localhost-cert.pem in the current working directory.

Example usage:

Deno.serve({
  ...await loadKeyAndCert(),
})

The easiest way to generate those files is using mkcert.

Returns

Promise<KeyAndCert | undefined>

options that can be added to the Deno.serve options