summaryrefslogtreecommitdiff
path: root/std/http/README.md
diff options
context:
space:
mode:
authorAndy Hayden <andyhayden1@gmail.com>2019-10-27 06:04:42 -0700
committerRy Dahl <ry@tinyclouds.org>2019-10-27 09:04:42 -0400
commitaec5a646c9218a0a0da62cbcd1f28bc23c242540 (patch)
treee052f0263eb2abc4915dc3710ec44ee34e9ad621 /std/http/README.md
parent51dd91a3ccfd9554bcf69b539f2f748da81c5b12 (diff)
feat: top-level-for-await (#3212)
Diffstat (limited to 'std/http/README.md')
-rw-r--r--std/http/README.md9
1 files changed, 3 insertions, 6 deletions
diff --git a/std/http/README.md b/std/http/README.md
index e4086c1a4..26fe25bf6 100644
--- a/std/http/README.md
+++ b/std/http/README.md
@@ -56,14 +56,11 @@ console.log("Set-Cookie:", cookieHeader);
```typescript
import { serve } from "https://deno.land/std/http/server.ts";
const s = serve("0.0.0.0:8000");
+const body = new TextEncoder().encode("Hello World\n");
-async function main() {
- for await (const req of s) {
- req.respond({ body: new TextEncoder().encode("Hello World\n") });
- }
+for await (const req of s) {
+ req.respond({ body });
}
-
-main();
```
### File Server