mirror of
https://github.com/denoland/deno.git
synced 2025-03-04 01:44:26 -05:00
improve docs (#5873)
This commit is contained in:
parent
44477596ed
commit
845bc443da
3 changed files with 6 additions and 6 deletions
|
@ -108,10 +108,10 @@ This time let's try with local source file, create `server.ts`:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { serve } from "https://deno.land/std@v0.50.0/http/server.ts";
|
import { serve } from "https://deno.land/std@v0.50.0/http/server.ts";
|
||||||
const s = serve({ port: 8000 });
|
const server = serve({ port: 8000 });
|
||||||
console.log("http://localhost:8000/");
|
console.log("http://localhost:8000/");
|
||||||
|
|
||||||
for await (const req of s) {
|
for await (const req of server) {
|
||||||
req.respond({ body: "Hello World\n" });
|
req.respond({ body: "Hello World\n" });
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { serve } from "https://deno.land/std/http/server.ts";
|
import { serve } from "https://deno.land/std/http/server.ts";
|
||||||
const s = serve({ port: 8000 });
|
const server = serve({ port: 8000 });
|
||||||
console.log("http://localhost:8000/");
|
console.log("http://localhost:8000/");
|
||||||
for await (const req of s) {
|
for await (const req of server) {
|
||||||
req.respond({ body: "Hello World\n" });
|
req.respond({ body: "Hello World\n" });
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
|
@ -247,8 +247,8 @@ export type HTTPOptions = Omit<Deno.ListenOptions, "transport">;
|
||||||
*
|
*
|
||||||
* import { serve } from "https://deno.land/std/http/server.ts";
|
* import { serve } from "https://deno.land/std/http/server.ts";
|
||||||
* const body = "Hello World\n";
|
* const body = "Hello World\n";
|
||||||
* const s = serve({ port: 8000 });
|
* const server = serve({ port: 8000 });
|
||||||
* for await (const req of s) {
|
* for await (const req of server) {
|
||||||
* req.respond({ body });
|
* req.respond({ body });
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue