You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sp...@apache.org on 2022/01/06 06:13:51 UTC

[apisix] branch master updated: docs: tiny enhancements on documentation("getting-started", "plugin" ) (#6016)

This is an automated email from the ASF dual-hosted git repository.

spacewander pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 1bfbf24  docs: tiny enhancements on documentation("getting-started", "plugin" ) (#6016)
1bfbf24 is described below

commit 1bfbf245831979378c9dfb9b4c599e3e4eab9639
Author: piglei <pi...@gmail.com>
AuthorDate: Thu Jan 6 14:13:44 2022 +0800

    docs: tiny enhancements on documentation("getting-started", "plugin" ) (#6016)
---
 docs/en/latest/getting-started.md              | 15 ++++++++-------
 docs/zh/latest/architecture-design/plugin.md   |  4 +++-
 docs/zh/latest/architecture-design/service.md  |  2 +-
 docs/zh/latest/architecture-design/upstream.md |  2 +-
 docs/zh/latest/getting-started.md              | 15 ++++++++-------
 5 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/docs/en/latest/getting-started.md b/docs/en/latest/getting-started.md
index 919ed52..cd30bfe 100644
--- a/docs/en/latest/getting-started.md
+++ b/docs/en/latest/getting-started.md
@@ -138,35 +138,36 @@ Apache APISIX provides users with a powerful [Admin API](./admin-api.md) and [AP
 
 We can create a [Route](./architecture-design/route.md) and connect it to an Upstream service(also known as the [Upstream](./architecture-design/upstream.md)). When a `Request` arrives at Apache APISIX, Apache APISIX knows which Upstream the request should be forwarded to.
 
-Because we have configured matching rules for the Route object, Apache APISIX can forward the request to the corresponding Upstream service. The following code is an example of a Route configuration:
+Because we have configured matching rules for the Route object, Apache APISIX can forward the request to the corresponding Upstream service. The following code creates a sample configuration of Route:
 
-```json
+```bash
+curl "http://127.0.0.1:9080/apisix/admin/routes/1" -H "X-API-KEY: edd1c9f034335f136f87ad84b625c8f1" -X PUT -d '
 {
   "methods": ["GET"],
   "host": "example.com",
-  "uri": "/services/users/*",
+  "uri": "/anything/*",
   "upstream": {
     "type": "roundrobin",
     "nodes": {
       "httpbin.org:80": 1
     }
   }
-}
+}'
 ```
 
 This routing configuration means that all matching inbound requests will be forwarded to the Upstream service `httpbin.org:80` when they meet **all** the rules listed below:
 
 - The HTTP method of the request is `GET`.
 - The request header contains the `host` field, and its value is `example.com`.
-- The request path matches `/services/users/*`, `*` means any subpath, for example `/services/users/getAll?limit=10`.
+- The request path matches `/anything/*`, `*` means any subpath, for example `/anything/foo?arg=10`.
 
 Once this route is created, we can access the Upstream service using the address exposed by Apache APISIX.
 
 ```bash
-curl -i -X GET "http://{APISIX_BASE_URL}/services/users/getAll?limit=10" -H "Host: example.com"
+curl -i -X GET "http://127.0.0.1:9080/anything/foo?arg=10" -H "Host: example.com"
 ```
 
-This will be forwarded to `http://httpbin.org:80/services/users/getAll?limit=10` by Apache APISIX.
+This will be forwarded to `http://httpbin.org:80/anything/foo?arg=10` by Apache APISIX.
 
 ### Create an Upstream
 
diff --git a/docs/zh/latest/architecture-design/plugin.md b/docs/zh/latest/architecture-design/plugin.md
index 433e7bd..daddd16 100644
--- a/docs/zh/latest/architecture-design/plugin.md
+++ b/docs/zh/latest/architecture-design/plugin.md
@@ -43,7 +43,9 @@ local _M = {
 }
 ```
 
-插件配置作为 Route 或 Service 的一部分提交的,放到 `plugins` 下。它内部是使用插件名字作为哈希的 key 来保存不同插件的配置项。
+插件配置可存放于 Route 或 Service 中,键为 `plugins`,值是包含多个插件配置的对象。对象内部用插件名字作为 key 来保存不同插件的配置项。
+
+如下所示的配置中,包含 `limit-count` 和 `prometheus` 两种插件的配置:
 
 ```json
 {
diff --git a/docs/zh/latest/architecture-design/service.md b/docs/zh/latest/architecture-design/service.md
index 154c647..e5c1508 100644
--- a/docs/zh/latest/architecture-design/service.md
+++ b/docs/zh/latest/architecture-design/service.md
@@ -85,4 +85,4 @@ curl http://127.0.0.1:9080/apisix/admin/routes/102 -H 'X-API-KEY: edd1c9f034335f
 }'
 ```
 
-注意:当 Route 和 Service 都开启同一个插件时,Route 参数的优先级是高于 Service 的。
+注意:当 Route 和 Service 都开启同一个插件时,Route 中的插件参数会优先于 Service 被使用。
diff --git a/docs/zh/latest/architecture-design/upstream.md b/docs/zh/latest/architecture-design/upstream.md
index f8561ce..8f06caa 100644
--- a/docs/zh/latest/architecture-design/upstream.md
+++ b/docs/zh/latest/architecture-design/upstream.md
@@ -27,7 +27,7 @@ Upstream 是虚拟主机抽象,对给定的多个服务节点按照配置规
 
 如上图所示,通过创建 Upstream 对象,在 `Route` 用 ID 方式引用,就可以确保只维护一个对象的值了。
 
-Upstream 的配置可以被直接绑定在指定 `Route` 中,也可以被绑定在 `Service` 中,不过 `Route` 中的配置优先级更高。这里的优先级行为与 `Plugin` 非常相似
+Upstream 的配置可以被直接绑定在指定 `Route` 中,也可以被绑定在 `Service` 中,不过 `Route` 中的配置优先级更高。这里的优先级行为与 `Plugin` 非常相似。
 
 ### 配置参数
 
diff --git a/docs/zh/latest/getting-started.md b/docs/zh/latest/getting-started.md
index b7c996d..1780d11 100644
--- a/docs/zh/latest/getting-started.md
+++ b/docs/zh/latest/getting-started.md
@@ -136,35 +136,36 @@ Apache APISIX 提供了强大的 [Admin API](./admin-api.md) 和 [Dashboard](htt
 
 我们可以创建一个 [Route](./architecture-design/route.md) 并与上游服务(通常也被称为 [Upstream](./architecture-design/upstream.md) 或后端服务)绑定,当一个 `请求(Request)` 到达 Apache APISIX 时,Apache APISIX 就会明白这个请求应该转发到哪个上游服务中。
 
-因为我们为 Route 对象配置了匹配规则,所以 Apache APISIX 可以将请求转发到对应的上游服务。以下代码是一个 Route 配置示例:
+因为我们为 Route 对象配置了匹配规则,所以 Apache APISIX 可以将请求转发到对应的上游服务。以下代码会创建一个示例 Route 配置:
 
-```json
+```bash
+curl "http://127.0.0.1:9080/apisix/admin/routes/1" -H "X-API-KEY: edd1c9f034335f136f87ad84b625c8f1" -X PUT -d '
 {
   "methods": ["GET"],
   "host": "example.com",
-  "uri": "/services/users/*",
+  "uri": "/anything/*",
   "upstream": {
     "type": "roundrobin",
     "nodes": {
       "httpbin.org:80": 1
     }
   }
-}
+}'
 ```
 
 这条路由配置意味着,当它们满足下述的 **所有** 规则时,所有匹配的入站请求都将被转发到 `httpbin.org:80` 这个上游服务:
 
 - 请求的 HTTP 方法为 `GET`。
 - 请求头包含 `host` 字段,且它的值为 `example.com`。
-- 请求路径匹配 `/services/users/*`,`*` 意味着任意的子路径,例如 `/services/users/getAll?limit=10`。
+- 请求路径匹配 `/anything/*`,`*` 意味着任意的子路径,例如 `/anything/foo?arg=10`。
 
 当这条路由创建后,我们可以使用 Apache APISIX 对外暴露的地址去访问上游服务:
 
 ```bash
-curl -i -X GET "http://{APISIX_BASE_URL}/services/users/getAll?limit=10" -H "Host: example.com"
+curl -i -X GET "http://127.0.0.1:9080/anything/foo?arg=10" -H "Host: example.com"
 ```
 
-这将会被 Apache APISIX 转发到 `http://httpbin.org:80/services/users/getAll?limit=10`。
+这将会被 Apache APISIX 转发到 `http://httpbin.org:80/anything/foo?arg=10`。
 
 ### 创建上游服务(Upstream)