feat: add http2.dart
This commit is contained in:
17
http2.dart
Normal file
17
http2.dart
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
const listener = Deno.listenTls({
|
||||||
|
port: 443,
|
||||||
|
certFile: "./cert.pem",
|
||||||
|
keyFile: "./key.pem",
|
||||||
|
alpnProtocols: ["h2", "http/1.1"],
|
||||||
|
});
|
||||||
|
|
||||||
|
for await (const conn of listener) {
|
||||||
|
handleConn(conn);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleConn(conn: Deno.Conn) {
|
||||||
|
const httpConn = Deno.serveHttp(conn);
|
||||||
|
for await (const { request, respondWith } of httpConn) {
|
||||||
|
respondWith(new Response(`Responding to ${request.url}`));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user