@modern-js/main-doc 0.0.0-next-1686556718687 → 0.0.0-next-1686559924703

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @modern-js/main-doc
2
2
 
3
- ## 0.0.0-next-1686556718687
3
+ ## 0.0.0-next-1686559924703
4
4
 
5
5
  ### Patch Changes
6
6
 
@@ -24,12 +24,12 @@
24
24
 
25
25
  docs(main): 更新 HTML 模板文档
26
26
 
27
- - d6625cb47: docs(main): update bff config doc
27
+ - d67b665c9: docs(main): update bff config doc
28
28
 
29
29
  docs(main): 更新 BFF 配置文档
30
30
 
31
31
  - Updated dependencies [7e6fb5fc1]
32
- - @modern-js/builder-doc@0.0.0-next-1686556718687
32
+ - @modern-js/builder-doc@0.0.0-next-1686559924703
33
33
 
34
34
  ## 2.22.1
35
35
 
@@ -0,0 +1,16 @@
1
+ Path rewriting can also be performed here, such as proxying the request sent to `localhost:8080/api/topics` to `https://cnodejs.org/api/v1/topics`.
2
+
3
+ ```js title="modern.server-runtime.config.js"
4
+ import { defineConfig } from '@modern-js/app-tools/server';
5
+ export default defineConfig({
6
+ bff: {
7
+ proxy: {
8
+ '/api': {
9
+ target: 'https://cnodejs.org',
10
+ pathRewrite: { '/api/topics': '/api/v1/topics' },
11
+ changeOrigin: true,
12
+ },
13
+ },
14
+ },
15
+ });
16
+ ```
@@ -28,28 +28,15 @@ export default defineConfig({
28
28
 
29
29
  Assuming the address of Modern.js BFF server is `localhost:8080`, all requests starting with `api` will be proxied to `https://cnodejs.org`, for example, the request to `localhost:8080/api/v1/topics` will be proxied to `https://cnodejs.org/api/v1/topics`.
30
30
 
31
- Path rewriting can also be performed here, such as proxying the request sent to `localhost:8080/api/topics` to `https://cnodejs.org/api/v1/topics`.
31
+ import BFFProxyPathRewrite from "@site-docs/components/bff-proxy-path-rewrite";
32
32
 
33
- ```js title="modern.server-runtime.config.js"
34
- import { defineConfig } from '@modern-js/app-tools/server';
35
- export default defineConfig({
36
- bff: {
37
- proxy: {
38
- '/api': {
39
- target: 'https://cnodejs.org',
40
- pathRewrite: { '/api/topics': '/api/v1/topics' },
41
- changeOrigin: true,
42
- },
43
- },
44
- },
45
- });
46
- ```
33
+ <BFFProxyPathRewrite />
47
34
 
48
35
  Unlike [dev.proxy](/configure/app/dev/proxy), the proxy here only applies to requests entering the BFF/API service; at the same time, this configuration can not only be used in the development environment, but also proxies corresponding requests in the production environment.
49
36
 
50
- import BFFProxyOtherConfig from "@site-docs-en/components/bff-proxy-other-config";
37
+ import BFFProxyPrinciple from "@site-docs/components/bff-proxy-principle";
51
38
 
52
- <BFFProxyOtherConfig />
39
+ <BFFProxyPrinciple />
53
40
 
54
41
  ## Common Usage
55
42
 
@@ -0,0 +1,16 @@
1
+ 这里还可以进行路径重写,如将发送到 `localhost:8080/api/topics` 的请求代理到 `https://cnodejs.org/api/v1/topics`。
2
+
3
+ ```ts title="modern.server-runtime.config.ts"
4
+ import { defineConfig } from '@modern-js/app-tools/server';
5
+ export default defineConfig({
6
+ bff: {
7
+ proxy: {
8
+ '/api': {
9
+ target: 'https://cnodejs.org',
10
+ pathRewrite: { '/api/topics': '/api/v1/topics' },
11
+ changeOrigin: true,
12
+ },
13
+ },
14
+ },
15
+ });
16
+ ```
@@ -28,28 +28,15 @@ export default defineConfig({
28
28
 
29
29
  假设 Modern.js BFF server 的地址是 `localhost:8080`,所有以 `api` 开头的请求都会被代理到 `https://cnodejs.org`,如 `localhost:8080/api/v1/topics` 的请求会被代理到 `https://cnodejs.org/api/v1/topics`。
30
30
 
31
- 这里还可以进行路径重写,如将发送到 `localhost:8080/api/topics` 的请求代理到 `https://cnodejs.org/api/v1/topics`。
31
+ import BFFProxyPathRewrite from "@site-docs/components/bff-proxy-path-rewrite";
32
32
 
33
- ```ts title="modern.server-runtime.config.ts"
34
- import { defineConfig } from '@modern-js/app-tools/server';
35
- export default defineConfig({
36
- bff: {
37
- proxy: {
38
- '/api': {
39
- target: 'https://cnodejs.org',
40
- pathRewrite: { '/api/topics': '/api/v1/topics' },
41
- changeOrigin: true,
42
- },
43
- },
44
- },
45
- });
46
- ```
33
+ <BFFProxyPathRewrite />
47
34
 
48
35
  与 [dev.proxy](/configure/app/dev/proxy) 不同,本节所介绍的代理只作用于进入 BFF/API 服务的请求;同时,这一配置不但可以在开发环境中使用,在生产环境中也会代理相应的请求。
49
36
 
50
- import BFFProxyOtherConfig from "@site-docs/components/bff-proxy-other-config";
37
+ import BFFProxyPrinciple from "@site-docs/components/bff-proxy-principle";
51
38
 
52
- <BFFProxyOtherConfig />
39
+ <BFFProxyPrinciple />
53
40
 
54
41
  ## 常见用法
55
42
 
package/package.json CHANGED
@@ -15,14 +15,14 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "0.0.0-next-1686556718687",
18
+ "version": "0.0.0-next-1686559924703",
19
19
  "publishConfig": {
20
20
  "registry": "https://registry.npmjs.org/",
21
21
  "access": "public",
22
22
  "provenance": true
23
23
  },
24
24
  "peerDependencies": {
25
- "@modern-js/builder-doc": "0.0.0-next-1686556718687"
25
+ "@modern-js/builder-doc": "0.0.0-next-1686559924703"
26
26
  },
27
27
  "devDependencies": {
28
28
  "classnames": "^2",
@@ -34,9 +34,9 @@
34
34
  "fs-extra": "^10",
35
35
  "@types/node": "^16",
36
36
  "@types/fs-extra": "^9",
37
- "@modern-js/doc-tools": "0.0.0-next-1686556718687",
38
- "@modern-js/doc-plugin-auto-sidebar": "0.0.0-next-1686556718687",
39
- "@modern-js/builder-doc": "0.0.0-next-1686556718687"
37
+ "@modern-js/builder-doc": "0.0.0-next-1686559924703",
38
+ "@modern-js/doc-tools": "0.0.0-next-1686559924703",
39
+ "@modern-js/doc-plugin-auto-sidebar": "0.0.0-next-1686559924703"
40
40
  },
41
41
  "scripts": {
42
42
  "dev": "modern dev",