feat add native_http_server.dart

This commit is contained in:
2021-04-24 21:34:27 +08:00
parent 6ff5113ad9
commit 0ce5299044

10
native_http_server.dart Normal file
View File

@@ -0,0 +1,10 @@
// deno --unstable native_http_server.dart
const body = new TextEncoder().encode("Hello World");
for await (const conn of Deno.listen({ port: 4500 })) {
(async () => {
for await (const { respondWith } of Deno.serveHttp(conn)) {
respondWith(new Response(body));
}
})();
}