Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

docs: mock use middleware #612

Merged
merged 3 commits into from
Oct 27, 2022
Merged

docs: mock use middleware #612

merged 3 commits into from
Oct 27, 2022

Conversation

luhc228
Copy link
Member

@luhc228 luhc228 commented Oct 20, 2022

@vercel
Copy link

vercel bot commented Oct 20, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
ice-v3 ✅ Ready (Inspect) Visit Preview Oct 27, 2022 at 2:38AM (UTC)


## 处理请求数据

如果用户希望使用一些的中间件来处理请求的数据(`req` 对象),可以参考以下的示例代码:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果用户希望使用一些中间件来处理请求的数据

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

bodyParser.json({ limit: '5mb', strict: false })(req, res, async () => {
console.log(req.body);

res.send({});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注释解释一下, 这个 req 和 res 的定义可以从哪里看到定义(外链也可)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

增加了类型

answershuto
answershuto previously approved these changes Oct 21, 2022

```ts
import bodyParser from 'body-parser';
import { Request, Response } from 'express';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import type {}

@luhc228 luhc228 requested a review from ClarkXia October 27, 2022 02:36
@ClarkXia ClarkXia merged commit 3e491e8 into release-next Oct 27, 2022
@ClarkXia ClarkXia deleted the docs/mock-middleware branch October 27, 2022 05:53
@ClarkXia ClarkXia mentioned this pull request Oct 27, 2022
16 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants