deno.land / std@0.157.0 / http / testdata / simple_https_server.ts

simple_https_server.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.// This is an example of a https serverimport { listenAndServeTls } from "../server.ts";import { dirname, fromFileUrl, join } from "../../path/mod.ts";
const moduleDir = dirname(fromFileUrl(import.meta.url));
const addr = "0.0.0.0:4505";const certFile = join(moduleDir, "tls/localhost.crt");const keyFile = join(moduleDir, "tls/localhost.key");const encoder = new TextEncoder();const body = encoder.encode("Hello HTTPS!");
console.log(`Simple HTTPS server listening on https://localhost:4505`);
await listenAndServeTls(addr, certFile, keyFile, () => new Response(body));
std

Version Info

Tagged at
a year ago