diff options
| author | hashrock <hashrock@users.noreply.github.com> | 2018-12-01 16:40:04 +0900 |
|---|---|---|
| committer | Ryan Dahl <ry@tinyclouds.org> | 2018-11-30 23:40:04 -0800 |
| commit | 6a7c01c2f039c9e3be8a5c4694322dc0a39e78df (patch) | |
| tree | 0c3bb44bdd6a38816575fb736954398be2170768 | |
| parent | e931c53a234a55f29169415cac016e4d792f7f97 (diff) | |
Update usage (denoland/deno_std#2)
Original: https://github.com/denoland/deno_std/commit/f574e3c6dbb1728c149a3478b11873e03b5ca439
| -rw-r--r-- | README.md | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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(); ``` |
