@orveth/https

Load PEM certificate material from disk and start an HTTPS listener backed by an Orveth application.

Exports

  • readTlsFilePair(paths) — reads cert, key, optional ca into buffers for Node TLS.
  • listenHttps(target, port, tls) — binds https.createServer to an Orveth app or any Node RequestListener.

Example

src/https-server.ts
import { Orveth } from "@orveth/server";
import { listenHttps, readTlsFilePair } from "@orveth/https";

const app = new Orveth();
app.get("/health", (ctx) => ctx.ok({ ok: true }));

const tls = await readTlsFilePair({
  certPath: process.env.TLS_CERT_PATH!,
  keyPath: process.env.TLS_KEY_PATH!,
});

await listenHttps(app, Number(process.env.PORT ?? 443), tls);

Manual server control

Use app.toRequestListener() from @orveth/server when you need to configure the Node https.Server yourself (custom timeouts, ALPN, etc.).