mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 15:24:46 -05:00
Fix http server example in homepage (#1801)
This fixes http server example by updating the import path as well as using respond() correctly.
This commit is contained in:
parent
a1de28dbef
commit
97e29e3dd0
1 changed files with 3 additions and 3 deletions
|
@ -104,12 +104,12 @@ href="https://github.com/denoland/deno_install/blob/master/install.ps1">https://
|
|||
|
||||
<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") });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue