serveTLS 与 Deno 0.23.0 一起登陆:
示例用法:
import { serveTLS } from "https://deno.land/std/http/server.ts";
const body = new TextEncoder().encode("Hello HTTPS");
const options = {
hostname: "localhost",
port: 443,
certFile: "./path/to/localhost.crt",
keyFile: "./path/to/localhost.key",
};
// Top-level await supported
for await (const req of serveTLS(options)) {
req.respond({ body });
}
Run Code Online (Sandbox Code Playgroud)
小智 -2
你检查过 DENO ABC 了吗?它是创建 Web 应用程序的更好框架。欲了解更多信息,请访问https://deno.land/x/abc/README.md。
import { abc } from "https://deno.sh/abc/mod.ts";
const app = abc();
app
.get("/hello", c => {
return "Hello, Abc!";
})
.start("0.0.0.0:8080");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2429 次 |
| 最近记录: |