summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhashrock <hashrock@users.noreply.github.com>2018-12-01 16:40:04 +0900
committerRyan Dahl <ry@tinyclouds.org>2018-11-30 23:40:04 -0800
commit6a7c01c2f039c9e3be8a5c4694322dc0a39e78df (patch)
tree0c3bb44bdd6a38816575fb736954398be2170768
parente931c53a234a55f29169415cac016e4d792f7f97 (diff)
Update usage (denoland/deno_std#2)
Original: https://github.com/denoland/deno_std/commit/f574e3c6dbb1728c149a3478b11873e03b5ca439
-rw-r--r--README.md9
1 files changed, 7 insertions, 2 deletions
diff --git a/README.md b/README.md
index 614e53087..ee6009304 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,12 @@ Usage:
```typescript
import { serve } from "https://deno.land/x/net/http.ts";
const s = serve("0.0.0.0:8000");
-for await (const req of s) {
- req.respond({ body: "Hello World\n" });
+
+async function main() {
+ for await (const req of s) {
+ req.respond({ body: new TextEncoder().encode("Hello World\n") });
+ }
}
+
+main();
```