From 6a7c01c2f039c9e3be8a5c4694322dc0a39e78df Mon Sep 17 00:00:00 2001 From: hashrock Date: Sat, 1 Dec 2018 16:40:04 +0900 Subject: [PATCH] Update usage (denoland/deno_std#2) Original: https://github.com/denoland/deno_std/commit/f574e3c6dbb1728c149a3478b11873e03b5ca439 --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 614e530875aff0..ee6009304f8d9f 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(); ```