blob: a959846ce66152db37ae62db5e90a5a85d7ba808 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
const { serve, upgradeHttpRaw } = Deno;
const u8 = Deno[Deno.internal].core.encode(
"HTTP/1.1 101 Switching Protocols\r\n\r\n",
);
async function handler(req) {
const [conn, _firstPacket] = upgradeHttpRaw(req);
await conn.write(u8);
await conn.close();
}
serve({ hostname: "127.0.0.1", port: 9000 }, handler);
|