1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-27 16:10:57 -05:00
Original: f574e3c6db
This commit is contained in:
hashrock 2018-12-01 16:40:04 +09:00 committed by Ryan Dahl
parent e931c53a23
commit 6a7c01c2f0

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