mirror of
https://github.com/denoland/deno.git
synced 2024-11-27 16:10:57 -05:00
parent
e931c53a23
commit
6a7c01c2f0
1 changed files with 7 additions and 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();
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue