forked from denoland/std
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
http: add serveTLS and listenAndServeTLS (denoland/deno#3257)
- Loading branch information
1 parent
1abe6fe
commit 63f2f98
Showing
4 changed files
with
124 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. | ||
// This is an example of a https server | ||
import { serveTLS } from "../server.ts"; | ||
|
||
const tlsOptions = { | ||
hostname: "localhost", | ||
port: 4503, | ||
certFile: "./http/testdata/tls/localhost.crt", | ||
keyFile: "./http/testdata/tls/localhost.key", | ||
}; | ||
const s = serveTLS(tlsOptions); | ||
console.log(`Simple HTTPS server listening on ${tlsOptions.hostname}:${tlsOptions.port}`); | ||
const body = new TextEncoder().encode("Hello HTTPS"); | ||
for await (const req of s) { | ||
req.respond({ body }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../cli/tests/tls |