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

tokers 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 8a2a6d1  docs: improve Getting Started (#4149)
8a2a6d1 is described below

commit 8a2a6d18fe9877440799a1ecd76c9099c4e27e73
Author: 琚致远 <[email protected]>
AuthorDate: Sun May 2 09:25:35 2021 +0800

    docs: improve Getting Started (#4149)
---
 docs/en/latest/getting-started.md | 52 +++++++++++++++---------------------
 docs/zh/latest/getting-started.md | 56 ++++++++++++++++-----------------------
 2 files changed, 44 insertions(+), 64 deletions(-)

diff --git a/docs/en/latest/getting-started.md 
b/docs/en/latest/getting-started.md
index 33001f7..53660f6 100644
--- a/docs/en/latest/getting-started.md
+++ b/docs/en/latest/getting-started.md
@@ -42,20 +42,10 @@ $ curl --location --request GET 
"http://httpbin.org/get?foo1=bar1&foo2=bar2";
     "foo2": "bar2"
   },
   "headers": {
-    "Accept": 
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
-    "Accept-Encoding": "gzip, deflate, br",
-    "Accept-Language": "en,zh-CN;q=0.9,zh;q=0.8",
-    "Cache-Control": "max-age=0",
+    "Accept": "*/*",
     "Host": "httpbin.org",
-    "Sec-Ch-Ua": "\"Google Chrome\";v=\"89\", \"Chromium\";v=\"89\", \";Not A 
Brand\";v=\"99\"",
-    "Sec-Ch-Ua-Mobile": "?0",
-    "Sec-Fetch-Dest": "document",
-    "Sec-Fetch-Mode": "navigate",
-    "Sec-Fetch-Site": "none",
-    "Sec-Fetch-User": "?1",
-    "Upgrade-Insecure-Requests": "1",
-    "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) 
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36",
-    "X-Amzn-Trace-Id": "Root=1-606276ab-2b451d4b36057c186d666351"
+    "User-Agent": "curl/7.29.0",
+    "X-Amzn-Trace-Id": "Root=1-6088fe84-24f39487166cce1f0e41efc9"
   },
   "origin": "58.152.81.42",
   "url": "http://httpbin.org/get?foo1=bar1&foo2=bar2";
@@ -100,13 +90,13 @@ We expect the following data to be returned:
 
 ```json
 {
-  "node": {
-    "createdIndex": 6,
-    "modifiedIndex": 6,
-    "key": "/apisix/services",
-    "dir": true
-  },
-  "action": "get"
+  "count":"1",
+  "action":"get",
+  "node":{
+    "key":"/apisix/services",
+    "nodes":{},
+    "dir":true
+  }
 }
 ```
 
@@ -155,7 +145,7 @@ This will be forward to 
`http://httpbin.org:80/getAll?limit=10` by Apache APISIX
 After reading the above section, we know we have to set the `Upstream` for 
`Route`. Just executing the following command to create one:
 
 ```bash
-$ curl "http://127.0.0.1:9080/apisix/admin/upstreams/50"; -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+$ curl "http://127.0.0.1:9080/apisix/admin/upstreams/1"; -H "X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1" -X PUT -d '
 {
   "type": "roundrobin",
   "nodes": {
@@ -173,11 +163,11 @@ We use `roundrobin` as our load balancer mechanism, and 
set `httpbin.org:80` as
 We just created an Upstream(Reference to our backend services), let's bind one 
Route with it!
 
 ```bash
-$ curl "http://127.0.0.1:9080/apisix/admin/routes/5"; -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+$ curl "http://127.0.0.1:9080/apisix/admin/routes/1"; -H "X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1" -X PUT -d '
 {
   "uri": "/get",
   "host": "httpbin.org",
-  "upstream_id": "50"
+  "upstream_id": "1"
 }'
 ```
 
@@ -202,12 +192,12 @@ Let's do some interesting things, due to **anyone** could 
access our public `Rou
 First, let's create the [consumer](./architecture-design/consumer.md) `John` 
with [key-auth](./plugins/key-auth.md) plugin, we need to provide a specified 
secret key:
 
 ```bash
-$ curl http://127.0.0.1:9080/apisix/admin/consumers -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+$ curl "http://127.0.0.1:9080/apisix/admin/consumers"; -H "X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1" -X PUT -d '
 {
   "username": "john",
   "plugins": {
     "key-auth": {
-      "key": "superSecretAPIKey"
+      "key": "key-of-john"
     }
   }
 }'
@@ -216,21 +206,21 @@ $ curl http://127.0.0.1:9080/apisix/admin/consumers -H 
'X-API-KEY: edd1c9f034335
 Next, let's bind our `Consumer(John)` to that `Route`, we only need to 
**Enable** the [key-auth](./plugins/key-auth.md) plugin for that `Route`:
 
 ```bash
-$ curl http://127.0.0.1:9080/apisix/admin/routes/5 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+$ curl "http://127.0.0.1:9080/apisix/admin/routes/1"; -H "X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1" -X PUT -d '
 {
   "uri": "/get",
   "host": "httpbin.org",
   "plugins": {
     "key-auth": {}
   },
-  "upstream_id": 50
+  "upstream_id": "1"
 }'
 ```
 
 Ok, when we access the `Route` created in Step2 from now on, an **Unauthorized 
Error** will occur. Let's see how to access that `Route`:
 
 ```bash
-$ curl -i -X GET http://127.0.0.1:9080/get -H "Host: httpbin.org" -H 'apikey: 
superSecretAPIKey'
+$ curl -i -X GET "http://127.0.0.1:9080/get"; -H "Host: httpbin.org" -H 
"apikey: key-of-john"
 ```
 
 Ya, just added an `Header` called `apikey` with correct key! It's so easy to 
protect any `Routes`, right?
@@ -241,7 +231,7 @@ Now lets say you want to add a prefix (eg: samplePrefix) to 
the route and do not
 the proxy-rewrite plugin to do it.
 
 ```bash
-$ curl http://127.0.0.1:9080/apisix/admin/routes/5 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+$ curl "http://127.0.0.1:9080/apisix/admin/routes/1"; -H "X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1" -X PUT -d '
 {
   "uri": "/samplePrefix/get",
   "plugins": {
@@ -250,14 +240,14 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/5 -H 
'X-API-KEY: edd1c9f034335f
     },
     "key-auth": {}
   },
-  "upstream_id": 50
+  "upstream_id": "1"
 }'
 ```
 
 Now you can invoke the route with the following command:
 
 ```bash
-$ curl -i -X GET 
'http://127.0.0.1:9080/samplePrefix/get?param1=foo&param2=bar' -H 'apikey: 
superSecretAPIKey'
+$ curl -i -X GET 
"http://127.0.0.1:9080/samplePrefix/get?param1=foo&param2=bar"; -H "apikey: 
key-of-john"
 ```
 
 ### APISIX Dashboard
diff --git a/docs/zh/latest/getting-started.md 
b/docs/zh/latest/getting-started.md
index 1038e5a..536f838 100644
--- a/docs/zh/latest/getting-started.md
+++ b/docs/zh/latest/getting-started.md
@@ -40,20 +40,10 @@ $ curl --location --request GET 
"http://httpbin.org/get?foo1=bar1&foo2=bar2";
     "foo2": "bar2"
   },
   "headers": {
-    "Accept": 
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
-    "Accept-Encoding": "gzip, deflate, br",
-    "Accept-Language": "en,zh-CN;q=0.9,zh;q=0.8",
-    "Cache-Control": "max-age=0",
+    "Accept": "*/*",
     "Host": "httpbin.org",
-    "Sec-Ch-Ua": "\"Google Chrome\";v=\"89\", \"Chromium\";v=\"89\", \";Not A 
Brand\";v=\"99\"",
-    "Sec-Ch-Ua-Mobile": "?0",
-    "Sec-Fetch-Dest": "document",
-    "Sec-Fetch-Mode": "navigate",
-    "Sec-Fetch-Site": "none",
-    "Sec-Fetch-User": "?1",
-    "Upgrade-Insecure-Requests": "1",
-    "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) 
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36",
-    "X-Amzn-Trace-Id": "Root=1-606276ab-2b451d4b36057c186d666351"
+    "User-Agent": "curl/7.29.0",
+    "X-Amzn-Trace-Id": "Root=1-6088fe84-24f39487166cce1f0e41efc9"
   },
   "origin": "58.152.81.42",
   "url": "http://httpbin.org/get?foo1=bar1&foo2=bar2";
@@ -96,13 +86,13 @@ $ curl "http://127.0.0.1:9080/apisix/admin/services/"; -H 
'X-API-KEY: edd1c9f0343
 
 ```json
 {
-  "node": {
-    "createdIndex": 6,
-    "modifiedIndex": 6,
-    "key": "/apisix/services",
-    "dir": true
-    },
-  "action": "get"
+  "count":"1",
+  "action":"get",
+  "node":{
+    "key":"/apisix/services",
+    "nodes":{},
+    "dir":true
+  }
 }
 ```
 
@@ -132,7 +122,7 @@ Apache APISIX 是如何知道的呢?那是因为我们为 Route 对象配置
 }
 ```
 
-这条路由配置意味着,当它们满足下述的 **所有** 规则时,所有匹配的入站请求都将被转发到 `httpbin.org:80` 上游,```
+这条路由配置意味着,当它们满足下述的 **所有** 规则时,所有匹配的入站请求都将被转发到 `httpbin.org:80` 上游:
 
 - 请求的 HTTP 方法为 `GET`;
 - 请求头包含 `Host` 字段,且它的值为 `example.com`;
@@ -151,7 +141,7 @@ $ curl -i -X GET 
"http://{APISIX_BASE_URL}/services/users/getAll?limit=10"; -H "H
 读完上一节,我们知道必须为 `路由` 设置 `上游`。只需执行下面的命令即可创建一个上游:
 
 ```bash
-$ curl "http://127.0.0.1:9080/apisix/admin/upstreams/50"; -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+$ curl "http://127.0.0.1:9080/apisix/admin/upstreams/1"; -H "X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1" -X PUT -d '
 {
   "type": "roundrobin",
   "nodes": {
@@ -165,11 +155,11 @@ $ curl "http://127.0.0.1:9080/apisix/admin/upstreams/50"; 
-H 'X-API-KEY: edd1c9f0
 **注意:** 创建上游实际上并不是必需的,因为我们可以使用 [插件](./architecture-design/plugin.md) 
拦截请求,然后直接响应。但在本指南中,我们假设需要设置至少一个上游。
 
 ```bash
-$ curl "http://127.0.0.1:9080/apisix/admin/routes/5"; -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+$ curl "http://127.0.0.1:9080/apisix/admin/routes/1"; -H "X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1" -X PUT -d '
 {
   "uri": "/get",
   "host": "httpbin.org",
-  "upstream_id": "50"
+  "upstream_id": "1"
 }'
 ```
 
@@ -179,11 +169,11 @@ We just created an Upstream(Reference to our backend 
services), let's bind one R
 我们刚刚创建了一个上游(引用我们的后端服务),让我们为它绑定一个路由!
 
 ```bash
-$ curl "http://127.0.0.1:9080/apisix/admin/routes/5"; -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+$ curl "http://127.0.0.1:9080/apisix/admin/routes/1"; -H "X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1" -X PUT -d '
 {
   "uri": "/get",
   "host": "httpbin.org",
-  "upstream_id": "50"
+  "upstream_id": "1"
 }'
 ```
 
@@ -208,12 +198,12 @@ $ curl -i -X GET 
"http://127.0.0.1:9080/get?foo1=bar1&foo2=bar2"; -H "Host: httpb
 首先,让我们用 [key-auth](./plugins/key-auth.md) 插件创建一个 
[消费者(Consumer)](./architecture-design/consumer.md) `John`,我们需要提供一个指定的密钥:
 
 ```bash
-$ curl  http://127.0.0.1:9080/apisix/admin/consumers  -H  'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+$ curl "http://127.0.0.1:9080/apisix/admin/consumers"; -H "X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1" -X PUT -d '
 {
   "username": "john",
   "plugins": {
     "key-auth": {
-      "key": "superSecretAPIKey"
+      "key": "key-of-john"
     }
   }
 }'
@@ -222,14 +212,14 @@ $ curl  http://127.0.0.1:9080/apisix/admin/consumers  -H  
'X-API-KEY: edd1c9f034
 接下来,让我们绑定 `消费者(John)` 到路由上,我们仅仅需要为路由 **启用** [key-auth](./plugins/key-auth.md) 
插件即可。
 
 ```bash
-$ curl http://127.0.0.1:9080/apisix/admin/routes/5 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+$ curl "http://127.0.0.1:9080/apisix/admin/routes/1"; -H "X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1" -X PUT -d '
 {
   "uri": "/get",
   "host": "httpbin.org",
   "plugins": {
     "key-auth": {}
   },
-  "upstream_id": 50
+  "upstream_id": "1"
 }'
 ```
 
@@ -246,7 +236,7 @@ $ curl -i -X GET http://127.0.0.1:9080/get -H "Host: 
httpbin.org" -H 'apikey: su
 现在,假设您要向路由添加前缀(例如:samplePrefix),并且不想使用 `host` 头, 则可以使用 `proxy-rewrite` 插件来完成。
 
 ```bash
-$ curl http://127.0.0.1:9080/apisix/admin/routes/5 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+$ curl "http://127.0.0.1:9080/apisix/admin/routes/1"; -H "X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1" -X PUT -d '
 {
   "uri": "/samplePrefix/get",
   "plugins": {
@@ -255,14 +245,14 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/5 -H 
'X-API-KEY: edd1c9f034335f
     },
     "key-auth": {}
   },
-  "upstream_id": 50
+  "upstream_id": "1"
 }'
 ```
 
 现在您可以使用以下命令来调用路由:
 
 ```bash
-$ curl -i -X  GET 
'http://127.0.0.1:9080/samplePrefix/get?param1=foo&param2=bar' -H 'apikey: 
superSecretAPIKey'
+$ curl -i -X GET 
"http://127.0.0.1:9080/samplePrefix/get?param1=foo&param2=bar"; -H "apikey: 
key-of-john"
 ```
 
 ### APISIX Dashboard(控制台)

Reply via email to