Skip to content

Commit 2d89e4e

Browse files
authored
docs(main): update proxy doc (#3747)
* docs(main): update proxy doc * fix: comments
1 parent 8fa8566 commit 2d89e4e

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
Modern.js provides out-of-the-box global proxy plugin `@modern-js/plugin-proxy`, which is based on [whistle](https://github.com/avwo/whistle) and can be used to view and modify HTTP/HTTPS requests and responses, and can also be used as an HTTP proxy server.
1+
Modern.js provides an out-of-the-box global proxy plugin `@modern-js/plugin-proxy`, which is based on [whistle](https://github.com/avwo/whistle) and can be used to view and modify the requests and responses of HTTP/HTTPS, as well as be used as an HTTP proxy server.
22

3-
### Set Proxy Rules
3+
### Setting Proxy Rules
44

5-
After install the proxy plugin and filling in the rules, execute `pnpm run dev`, Modern.js will automatically enable the proxy server after the development server starts.
5+
After installing the proxy plugin and configuring the rules, run `pnpm run dev`. Modern.js will automatically enable the proxy server when the development server is started.
66

77
Specific proxy rules can be set via the [`dev.proxy`](/configure/app/dev/proxy) or the `config/proxy.js` file.
88

9-
### Use Proxy Dashboard
9+
### Proxy Dashboard
1010

11-
After exec `pnpm run dev` command:
11+
After installing the proxy plugin and configuring the proxy rules, run the `pnpm run dev` command:
1212

1313
```bash
1414
App running at:
@@ -20,8 +20,8 @@ After exec `pnpm run dev` command:
2020
✔ success Proxy Server start on localhost:8899
2121
```
2222

23-
In the console you can see that the proxy server started successfully.
23+
You can see that the proxy server has started successfully in the console.
2424

25-
Accessing the `http://localhost:8899` and, you can set the rules through the dashboard.
25+
Access `http://localhost:8899`, and you can set the rules through the dashboard.
2626

2727
![debug-proxy-ui](https://lf3-static.bytednsdoc.com/obj/eden-cn/aphqeh7uhohpquloj/modern-js/debug/debug-proxy-ui.png)

packages/document/main-doc/docs/en/guides/basic-features/proxy.mdx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sidebar_position: 5
66

77
## Local Proxy
88

9-
Modern.js provides a way to configure the development proxy in [tools.devServer](/configure/app/tools/dev-server). For example, to proxy the local interface to an online address:
9+
Modern.js provides a way to configure the development proxy in [`tools.devServer`](/configure/app/tools/dev-server). For example, to proxy the local interface to an online address:
1010

1111
```ts title="modern.config.ts"
1212
import { defineConfig } from '@modern-js/app-tools';
@@ -25,11 +25,10 @@ export default defineConfig({
2525
});
2626
```
2727

28-
when access `http://localhost:8080/go/api`, the response content is returned from [http://www.example.com/](http://www.example.com/).
28+
When access `http://localhost:8080/go/api`, the response content will be returned from [http://www.example.com/](http://www.example.com/).
2929

3030
:::info
3131
For more detail, see [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware).
32-
3332
:::
3433

3534
## Global Proxy
@@ -40,7 +39,7 @@ import GlobalProxy from "@site-docs-en/components/global-proxy"
4039

4140
## BFF Proxy
4241

43-
By configuring [`bff.proxy`](/configure/app/bff/proxy), you can proxy BFF API requests to specified services. Unlike other proxy above, it can also be used in the production environment:
42+
By configuring [`bff.proxy`](/configure/app/bff/proxy), BFF API requests can be proxied to a specified service. Unlike the other proxy methods above, it can be used in the production environment:
4443

4544
```ts title="modern.config.ts"
4645
export default defineConfig({
@@ -52,7 +51,7 @@ export default defineConfig({
5251
});
5352
```
5453

55-
For example, when a BFF call is used in the code, the final request `http://localhost:8080/api/v1/topics` will auto proxy to `https://cnodejs.org/api/v1/topics`:
54+
For example, when using BFF function in the code, the final request `http://localhost:8080/api/v1/topics` will be automatically proxied to `https://cnodejs.org/api/v1/topics`:
5655

5756
```js
5857
import getTopics from '@api/v1/topics';

0 commit comments

Comments
 (0)