add hello_server.ts

This commit is contained in:
2019-12-13 00:59:54 +08:00
parent 675fa9869d
commit 3d0c5ba0bf

View File

@@ -0,0 +1,10 @@
import { serve } from "https://deno.land/std/http/server.ts";
window.onload = async function() {
console.log('Start listen :8000 ...');
const body = new TextEncoder().encode("Hello World\n");
for await (const req of serve(":8000")) {
console.log('Received request: ' + JSON.stringify(req.conn));
req.respond({ body });
}
};