Skip to content

Commit

Permalink
Fix http server example in homepage (#1801)
Browse files Browse the repository at this point in the history
This fixes http server example by updating the import path as well as
using respond() correctly.
  • Loading branch information
saadq authored and ry committed Feb 18, 2019
1 parent a1de28d commit 97e29e3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions website/index.html
Expand Up @@ -104,12 +104,12 @@ <h2 id="example">Example <a href="#example">#</a></h2>

<p>Or a more complex one:</p>

<pre><code class="typescript language-typescript">import { serve } from "https://deno.land/x/http/server.ts";
<pre><code class="typescript language-typescript">import { serve } from "https://deno.land/x/std/http/server.ts";
const s = serve("0.0.0.0:8000");

async function main() {
for await (const req of s) {
req.respond({ body: new TextEncoder().encode("Hello World\n") });
for await (const { res } of s) {
res.respond({ body: new TextEncoder().encode("Hello World\n") });
}
}

Expand Down

0 comments on commit 97e29e3

Please sign in to comment.