mirror of
https://github.com/denoland/deno.git
synced 2025-10-03 07:34:36 +00:00
doc: improve linking to external code docs (#6158)
This commit is contained in:
parent
be8bacaaa4
commit
1120dfe3f2
4 changed files with 90 additions and 23 deletions
|
@ -16,27 +16,26 @@ Current limitations:
|
|||
|
||||
Example:
|
||||
|
||||
```js
|
||||
// import_map.json
|
||||
**import_map.json**
|
||||
|
||||
```js
|
||||
{
|
||||
"imports": {
|
||||
"http/": "https://deno.land/std/http/"
|
||||
"fmt/": "https://deno.land/std@0.55.0/fmt/"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**color.ts**
|
||||
|
||||
```ts
|
||||
// hello_server.ts
|
||||
import { red } from "fmt/colors.ts";
|
||||
|
||||
import { serve } from "http/server.ts";
|
||||
|
||||
const body = new TextEncoder().encode("Hello World\n");
|
||||
for await (const req of serve(":8000")) {
|
||||
req.respond({ body });
|
||||
}
|
||||
console.log(red("hello world"));
|
||||
```
|
||||
|
||||
Then:
|
||||
|
||||
```shell
|
||||
$ deno run --allow-net --importmap=import_map.json --unstable hello_server.ts
|
||||
$ deno run --importmap=import-map.json --unstable color.ts
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue