1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-03 12:58:54 -05:00

Update usage (#2)

This commit is contained in:
hashrock 2018-12-01 16:40:04 +09:00 committed by Ryan Dahl
parent 0c8ad6eb1a
commit f574e3c6db

View file

@ -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();
```