mirror of
https://github.com/denoland/deno.git
synced 2024-11-28 16:20:57 -05:00
Improve example on homepage (#2667)
This commit is contained in:
parent
621af21e6e
commit
a00d087b39
1 changed files with 7 additions and 8 deletions
|
@ -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>
|
<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";
|
<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");
|
||||||
async function main() {
|
const s = serve(":8000");
|
||||||
const body = new TextEncoder().encode("Hello World\n");
|
window.onload = async () => {
|
||||||
for await (const req of serve(":8000")) {
|
console.log("http://localhost:8000/");
|
||||||
|
for await (const req of s) {
|
||||||
req.respond({ body });
|
req.respond({ body });
|
||||||
}
|
}
|
||||||
}
|
};</code></pre>
|
||||||
|
|
||||||
main();</code></pre>
|
|
||||||
|
|
||||||
<h2 id="dig-in">Dig in... <a href="#dig-in">#</a></h2>
|
<h2 id="dig-in">Dig in... <a href="#dig-in">#</a></h2>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue