Skip to content

Commit

Permalink
Merge pull request #122 from conglinyizhi/main
Browse files Browse the repository at this point in the history
修复 file_server.md 文件因为标题没有空格导致的不正常显示标题的问题
  • Loading branch information
justjavac authored Oct 12, 2023
2 parents e4bebbe + 31e9fe8 commit eb10ad7
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 17 deletions.
2 changes: 1 addition & 1 deletion advanced/jsx_dom/css.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ body {
background: #eee;
color: #888;
}
`);
`);
assert(ast.stylesheet);
const body = ast.stylesheet.rules[0] as css.Rule;
Expand Down
7 changes: 5 additions & 2 deletions basics/testing/snapshot_testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ snapshot file.

```ts, ignore
// example_test.ts
import { assertSnapshot, serialize } from "https://deno.land/std@$STD_VERSION/testing/snapshot.ts";
import {
assertSnapshot,
serialize,
} from "https://deno.land/std@$STD_VERSION/testing/snapshot.ts";
import { stripColor } from "https://deno.land/std@$STD_VERSION/fmt/colors.ts";
/**
Expand Down Expand Up @@ -211,7 +214,7 @@ Deno.test("isSnapshotMatch", async function (t): Promise<void> {
example: 123,
};
await assertSnapshot(t, a, {
name: "Test Name"
name: "Test Name",
});
});
```
Expand Down
10 changes: 5 additions & 5 deletions examples/file_server.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#文件服务器
# 文件服务器

##概念
## 概念

- 使用 [Deno.open](/api?s=Deno.open) 以块读取文件内容。
- 将 Deno 文件转换为
[ReadableStream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream)
- 使用 Deno 集成的 HTTP 服务器运行自己的文件服务器。

##概述
## 概述

通过网络发送文件是一个常见的需求。如在
[获取数据示例](./fetch_data.md)中所示,由于文件的大小可以是任意的,因此使用流防止将整个文件加载到内存中至关重要。

##示例
## 示例

**命令:** `deno run --allow-read --allow-net file_server.ts`

Expand Down Expand Up @@ -53,7 +53,7 @@ async function handleHttp(conn: Deno.Conn) {
}
```

##使用 `std/http` 文件服务器
## 使用 `std/http` 文件服务器

Deno 标准库为您提供了
[file server](https://deno.land/std@$STD_VERSION/http/file_server.ts) ,使
Expand Down
5 changes: 4 additions & 1 deletion examples/module_metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ function outputA() {
"Is module A the main module via import.meta.main?",
import.meta.main,
);
console.log("Resolved specifier for ./module_b.ts", import.meta.resolve("./module_b.ts"));
console.log(
"Resolved specifier for ./module_b.ts",
import.meta.resolve("./module_b.ts"),
);
}
outputA();
Expand Down
6 changes: 4 additions & 2 deletions node/how_to_with_npm/express.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ app.get("/api", (req, res) => {
app.get("/api/:dinosaur", (req, res) => {
if (req?.params?.dinosaur) {
const found = data.find(item => item.name.toLowerCase() === req.params.dinosaur.toLowerCase());
const found = data.find((item) =>
item.name.toLowerCase() === req.params.dinosaur.toLowerCase()
);
if (found) {
res.send(found)
res.send(found);
} else {
res.send("未找到此类恐龙。");
}
Expand Down
6 changes: 4 additions & 2 deletions node/how_to_with_npm/react.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ router
})
.get("/api/:dinosaur", (context) => {
if (context?.params?.dinosaur) {
const found = data.find(item => item.name.toLowerCase() === context.params.dinosaur.toLowerCase());
const found = data.find((item) =>
item.name.toLowerCase() === context.params.dinosaur.toLowerCase()
);
if (found) {
context.response.body = found;
} else {
} else {
context.response.body = "No dinosaurs found.";
}
}
Expand Down
10 changes: 6 additions & 4 deletions node/how_to_with_npm/vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ router
})
.get("/api/:dinosaur", (context) => {
if (context?.params?.dinosaur) {
const found = data.find(item => item.name.toLowerCase() === context.params.dinosaur.toLowerCase());
const found = data.find((item) =>
item.name.toLowerCase() === context.params.dinosaur.toLowerCase()
);
if (found) {
context.response.body = found;
} else {
} else {
context.response.body = "No dinosaurs found.";
}
}
Expand Down Expand Up @@ -269,8 +271,8 @@ Tying it all together, let's update `src/App.vue`:

```tsx, ignore
<template>
<router-view/>
</template>
<router-view />
</template>;
```

## Add routing
Expand Down

0 comments on commit eb10ad7

Please sign in to comment.