feat add native_http_server.dart
This commit is contained in:
10
native_http_server.dart
Normal file
10
native_http_server.dart
Normal 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));
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user