summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2019-07-19 14:59:41 -0400
committerGitHub <noreply@github.com>2019-07-19 14:59:41 -0400
commita00d087b39da7894276c2292335d2709a6cebd8c (patch)
treec1e1a8d5ed169babeb9e4edacebaa4eeaa00b3a8
parent621af21e6eab9b0f736d5b6e8acc48dbad4a68d2 (diff)
Improve example on homepage (#2667)
-rw-r--r--website/index.html15
1 files 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
<p>Or a more complex one:</p>
- <pre><code class="typescript language-typescript">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")) {
+ <pre><code class="typescript language-typescript">import { serve } from "<a href="https://deno.land/std@v0.12/http/server.ts">https://deno.land/std@v0.12/http/server.ts</a>";
+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();</code></pre>
+};</code></pre>
<h2 id="dig-in">Dig in... <a href="#dig-in">#</a></h2>