mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-15 04:30:25 +00:00
Update version to 0.6.0
Also update the CHANGELOG and copyright years.
This commit is contained in:
parent
1a1b01c7c4
commit
0c2e2224e3
32 changed files with 163 additions and 79 deletions
14
README.md
14
README.md
|
@ -157,28 +157,28 @@ based on the hostname and path information from the request. It also lets
|
|||
you define static options for the handler directly in the rules.
|
||||
|
||||
To match the hostname and path, Cowboy requires a list of tokens. For
|
||||
example, to match the "dev-extend.eu" domain name, you must specify
|
||||
`[<<"dev-extend">>, <<"eu">>]`. Or, to match the "/path/to/my/resource"
|
||||
example, to match the "ninenines.eu" domain name, you must specify
|
||||
`[<<"ninenines">>, <<"eu">>]`. Or, to match the "/path/to/my/resource"
|
||||
you must use `[<<"path">>, <<"to">>, <<"my">>, <<"resource">>]`. All the
|
||||
tokens must be given as binary.
|
||||
|
||||
You can use the special token `'_'` (the atom underscore) to indicate that
|
||||
you accept anything in that position. For example if you have both
|
||||
"dev-extend.eu" and "dev-extend.fr" domains, you can use the match spec
|
||||
`[<<"dev-extend">>, '_']` to match any top level extension.
|
||||
"ninenines.eu" and "ninenines.fr" domains, you can use the match spec
|
||||
`[<<"ninenines">>, '_']` to match any top level extension.
|
||||
|
||||
Finally, you can also match multiple leading segments of the domain name and
|
||||
multiple trailing segments of the request path using the atom `'...'` (the atom
|
||||
ellipsis) respectively as the first host token or the last path token. For
|
||||
example, host rule `['...', <<"dev-extend">>, <<"eu">>]` can match both
|
||||
"cowboy.bugs.dev-extend.eu" and "dev-extend.eu" and path rule
|
||||
example, host rule `['...', <<"ninenines">>, <<"eu">>]` can match both
|
||||
"cowboy.bugs.ninenines.eu" and "ninenines.eu" and path rule
|
||||
`[<<"projects">>, '...']` can match both "/projects" and
|
||||
"/projects/cowboy/issues/42". The host leading segments and the path trailing
|
||||
segments can later be retrieved through `cowboy_http_req:host_info/1` and
|
||||
`cowboy_http_req:path_info/1`.
|
||||
|
||||
Any other atom used as a token will bind the value to this atom when
|
||||
matching. To follow on our hostnames example, `[<<"dev-extend">>, ext]`
|
||||
matching. To follow on our hostnames example, `[<<"ninenines">>, ext]`
|
||||
would bind the values `<<"eu">>` and `<<"fr">>` to the ext atom, that you
|
||||
can later retrieve in your handler by calling `cowboy_http_req:binding/{2,3}`.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue