This is an automated email from the ASF dual-hosted git repository.
wenming 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 3e3128527 docs: fix typo and added useful information (#8900)
3e3128527 is described below
commit 3e3128527b2890c9ab66f8eb868a52cb243dc410
Author: Abdul Raheem <[email protected]>
AuthorDate: Thu Jun 29 10:58:36 2023 +0500
docs: fix typo and added useful information (#8900)
* docs: fix typo and added useful information
* docs: fix typo and added useful information
Also fixed the failing test in this commit
---
docs/en/latest/router-radixtree.md | 43 ++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 23 deletions(-)
diff --git a/docs/en/latest/router-radixtree.md
b/docs/en/latest/router-radixtree.md
index 068b9777a..7f6bf7f97 100644
--- a/docs/en/latest/router-radixtree.md
+++ b/docs/en/latest/router-radixtree.md
@@ -1,5 +1,5 @@
---
-title: Router radixtree
+Title: Router Radixtree
---
<!--
@@ -21,17 +21,13 @@ title: Router radixtree
#
-->
-### what's libradixtree?
+### What is Libradixtree?
-[libradixtree](https://github.com/api7/lua-resty-radixtree), adaptive radix
trees implemented in Lua for OpenResty.
+[Libradixtree](https://github.com/api7/lua-resty-radixtree) is an adaptive
radix tree that is implemented in Lua for OpenResty and it is based on FFI for
[rax](https://github.com/antirez/rax). APISIX uses libradixtree as a route
dispatching library.
-APISIX using libradixtree as route dispatching library.
+### How to use Libradixtree in APISIX?
-### How to use libradixtree in APISIX?
-
-This is Lua-OpenResty implementation library base on FFI for
[rax](https://github.com/antirez/rax).
-
-Let's take a look at a few examples and have an intuitive understanding.
+There are several ways to use Libradixtree in APISIX. Let's take a look at a
few examples and have an intuitive understanding.
#### 1. Full match
@@ -39,7 +35,7 @@ Let's take a look at a few examples and have an intuitive
understanding.
/blog/foo
```
-It will only match `/blog/foo`.
+It will only match the full path `/blog/foo`.
#### 2. Prefix matching
@@ -47,12 +43,12 @@ It will only match `/blog/foo`.
/blog/bar*
```
-It will match the path with the prefix `/blog/bar`, eg: `/blog/bar/a`,
+It will match the path with the prefix `/blog/bar`. For example, `/blog/bar/a`,
`/blog/bar/b`, `/blog/bar/c/d/e`, `/blog/bar` etc.
#### 3. Match priority
-Full match -> Deep prefix matching.
+Full match has a higher priority than deep prefix matching.
Here are the rules:
@@ -77,7 +73,7 @@ When different routes have the same `uri`, you can set the
priority field of the
Note: In the matching rules, the `priority` field takes precedence over other
rules except `uri`.
-1. Different routes have the same `uri` and set the `priority` field
+1. Different routes have the same `uri` but different `priority` field
Create two routes with different `priority` values (the larger the value,
the higher the priority).
@@ -116,11 +112,11 @@ curl http://127.0.0.1:1980/hello
1980
```
-All requests only hit the route of port `1980`.
+All requests will only hit the route of port `1980` because it has a priority
of 3 while the route with the port of `1981` has a priority of 2.
-2. Different routes have the same `uri` and set different matching conditions
+2. Different routes have the same `uri` but different matching conditions
-Here is an example of setting host matching rules:
+To understand this, look at the example of setting host matching rules:
```shell
$ curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY:
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
@@ -191,10 +187,9 @@ will match both `/blog/dog` and `/blog/cat`.
For more details, see
https://github.com/api7/lua-resty-radixtree/#parameters-in-path.
-### How to filter route by Nginx builtin variable
+### How to filter route by Nginx built-in variable?
-Please take a look at
[radixtree-new](https://github.com/api7/lua-resty-radixtree#new),
-here is an simple example:
+Nginx provides a variety of built-in variables that can be used to filter
routes based on certain criteria. Here is an example of how to filter routes by
Nginx built-in variables:
```shell
$ curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY:
edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
@@ -216,9 +211,9 @@ $ curl http://127.0.0.1:9180/apisix/admin/routes/1 -H
'X-API-KEY: edd1c9f034335f
}'
```
-This route will require the request header `host` equal `iresty.com`, request
cookie key `_device_id` equal `a66f0cdc4ba2df8c096f74c9110163a9` etc.
+This route will require the request header `host` equal `iresty.com`, request
cookie key `_device_id` equal `a66f0cdc4ba2df8c096f74c9110163a9` etc. You can
learn more at [radixtree-new](https://github.com/api7/lua-resty-radixtree#new).
-### How to filter route by POST form attributes
+### How to filter route by POST form attributes?
APISIX supports filtering route by POST form attributes with `Content-Type` =
`application/x-www-form-urlencoded`.
@@ -243,11 +238,11 @@ $ curl http://127.0.0.1:9180/apisix/admin/routes/1 -H
'X-API-KEY: edd1c9f034335f
The route will be matched when the POST form contains `name=json`.
-### How to filter route by GraphQL attributes
+### How to filter route by GraphQL attributes?
APISIX can handle HTTP GET and POST methods. At the same time, the request
body can be a GraphQL query string or JSON-formatted content.
-APISIX supports filtering route by some attributes of GraphQL. Currently we
support:
+APISIX supports filtering routes by some attributes of GraphQL. Currently, we
support:
* graphql_operation
* graphql_name
@@ -266,6 +261,8 @@ query getRepo {
}
```
+Where
+
* The `graphql_operation` is `query`
* The `graphql_name` is `getRepo`,
* The `graphql_root_fields` is `["owner", "repo"]`