You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-11Lines changed: 9 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,11 +21,6 @@ Table of Contents
21
21
*[DEV ENV](#dev-env)
22
22
*[Benchmark](#benchmark)
23
23
24
-
Status
25
-
======
26
-
27
-
**This repository is an experimental.**
28
-
29
24
Synopsis
30
25
========
31
26
@@ -79,6 +74,7 @@ The attributes of each element may contain these:
79
74
|:-------- |:--------|:-----------|:-----|
80
75
|paths |required|A list of client request uri. The default is a full match, but if the end of the path is `*`, it means that this is a prefix path. For example `/foo*`, it'll match `/foo/bar` or `/foo/glo/grey` etc.|{"/", "/aa", "/bb"}|
81
76
|hosts |option |A list of client request host, not only supports normal domain name, but also supports wildcard name.|{"foo.com", "*.bar.com"}|
77
+
|uris |option |A list of client request uris, not only supports static uri, but also supports prefix uri.|{"/foo", "/bar/*"}|
82
78
|remote_addrs|option |A list of client remote address(IPv4 and IPv6), and we can use CIDR format, eg `192.168.1.0/24`.|{"127.0.0.1", "192.0.0.0/8", "::1", "fe80::/32"}|
83
79
|methods |option |A list of method name. Here is full valid method list: "GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT" and "TRACE".|{"GET", "POST"}|
84
80
|vars |option |A list of `{var, operator, val}`. For example: {{var, operator, val}, {var, operator, val}, ...}, `{"arg_name", "==", "json"}` means the value of argument `name` expect to `json`.|{{"arg_name", "==", "json"}, {"arg_age", ">", 18}}|
@@ -93,14 +89,15 @@ match
93
89
94
90
`syntax: metadata = rx:match(path, opts)`
95
91
96
-
*`path`: client request uri.
92
+
*`path`: client request path.
97
93
*`opts`: a Lua tale (optional).
98
94
*`method`: optional, method name of client request.
99
-
*`host`: optional, client request host, not only supports normal domain name, but also supports wildcard name, both `foo.com` and `*.foo.com` are valid.
95
+
*`host`: optional, client request host.
100
96
*`remote_addr`: optional, client remote address like `192.168.1.100`.
97
+
*`uri`: optional, client request uri.
101
98
*`vars`: optional, a Lua table to fetch variable, default value is `ngx.var` to fetch Ningx builtin variable.
102
99
103
-
Matchs the route by `method`, `path` and `host`, and return `metadata` if successful.
100
+
Matchs the route by `method`, `path` and `host` etc, and return `metadata` if successful.
104
101
105
102
```lua
106
103
localmetadata=rx:match(ngx.var.uri, {...})
@@ -113,14 +110,15 @@ dispatch
113
110
114
111
`syntax: ok = rx:dispatch(path, opts, ...)`
115
112
116
-
*`path`: client request uri.
113
+
*`path`: client request path.
117
114
*`opts`: a Lua tale (optional).
118
115
*`method`: optional, method name of client request.
119
-
*`host`: optional, client request host, not only supports normal domain name, but also supports wildcard name, both `foo.com` and `*.foo.com` are valid.
116
+
*`host`: optional, client request host.
120
117
*`remote_addr`: optional, client remote address like `192.168.1.100`.
118
+
*`uri`: optional, client request uri.
121
119
*`vars`: optional, a Lua table to fetch variable, default value is `ngx.var` to fetch Ningx builtin variable.
122
120
123
-
Dispatchs the route by `method`, `path` and `host`, and call `handler` function if successful.
121
+
Matchs the route by `method`, `path` and `host` etc, and call `handler` function if successful.
0 commit comments