diff --git a/http2.dart b/http2.dart new file mode 100644 index 0000000..f1cc474 --- /dev/null +++ b/http2.dart @@ -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}`)); + } +}