From a00d087b39da7894276c2292335d2709a6cebd8c Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Fri, 19 Jul 2019 14:59:41 -0400 Subject: Improve example on homepage (#2667) --- website/index.html | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/website/index.html b/website/index.html index 16370e46b..c0151dd44 100644 --- a/website/index.html +++ b/website/index.html @@ -113,16 +113,15 @@ href="https://deno.land/x/install/install.ps1">https://deno.land/x/install/insta

Or a more complex one:

-
import { serve } from "https://deno.land/std@v0.11/http/server.ts";
-
-async function main() {
-  const body = new TextEncoder().encode("Hello World\n");
-  for await (const req of serve(":8000")) {
+      
import { serve } from "https://deno.land/std@v0.12/http/server.ts";
+const body = new TextEncoder().encode("Hello World\n");
+const s = serve(":8000");
+window.onload = async () => {
+  console.log("http://localhost:8000/");
+  for await (const req of s) {
     req.respond({ body });
   }
-}
-
-main();
+};

Dig in... #

-- cgit v1.2.3