From d2a3f2cedd7c00d0933222aed9c06b3149aa4db4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 4 Apr 2018 13:13:37 +0200 Subject: Cowboy 2.3.0 --- docs/en/cowboy/2.0/guide/routing/index.html | 42 +++++++++++++++-------------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'docs/en/cowboy/2.0/guide/routing') diff --git a/docs/en/cowboy/2.0/guide/routing/index.html b/docs/en/cowboy/2.0/guide/routing/index.html index 715b4111..70e53566 100644 --- a/docs/en/cowboy/2.0/guide/routing/index.html +++ b/docs/en/cowboy/2.0/guide/routing/index.html @@ -7,7 +7,7 @@ - + Nine Nines: Routing @@ -80,7 +80,7 @@ The result of the compilation is the dispatch rules.

The general structure for the routes is defined as follow.

-
@@ -88,7 +88,7 @@ http://www.gnu.org/software/src-highlite -->

Each host contains matching rules for the host along with optional constraints, and a list of routes for the path component.

-
@@ -97,7 +97,7 @@ http://www.gnu.org/software/src-highlite -->

The list of routes for the path component is defined similar to the list of hosts.

-
@@ -106,7 +106,7 @@ http://www.gnu.org/software/src-highlite --> optional constraints, and gives us the handler module to be used along with its initial state.

-
@@ -130,7 +130,7 @@ when encountered.

the simplest match value is a host or a path. It can be given as either a string() or a binary().

-
@@ -142,7 +142,7 @@ http://www.gnu.org/software/src-highlite --> character. Note that these two paths are identical as far as routing is concerned.

-
@@ -151,7 +151,7 @@ http://www.gnu.org/software/src-highlite -->

Hosts with and without a trailing dot are equivalent for routing. Similarly, hosts with and without a leading dot are also equivalent.

-
@@ -165,7 +165,7 @@ values bindings.

the : character means that what follows until the end of the segment is the name of the binding in which the segment value will be stored.

-
@@ -184,7 +184,7 @@ variable in Erlang. Any match against the _ binding will succeed but the data will be discarded. This is especially useful for matching against many domain names in one go.

-
@@ -192,7 +192,7 @@ http://www.gnu.org/software/src-highlite -->

Similarly, it is possible to have optional segments. Anything between brackets is optional.

-
@@ -200,7 +200,7 @@ http://www.gnu.org/software/src-highlite --> HostMatch = "[www.]ninenines.eu".

You can also have imbricated optional segments.

-
@@ -213,7 +213,7 @@ zero, one or many segments. You can then find the segments using cowboy_req:host_info/1 and cowboy_req:path_info/1 respectively. They will be represented as a list of segments.

-
@@ -223,7 +223,7 @@ http://www.gnu.org/software/src-highlite --> will succeed only if they share the same value. This copies the Erlang pattern matching behavior.

-
@@ -232,7 +232,7 @@ http://www.gnu.org/software/src-highlite --> case the two values must be identical only if the segment is available.

-
@@ -240,7 +240,7 @@ http://www.gnu.org/software/src-highlite -->

If a binding is defined in both the host and path, then they must also share the same value.

-
@@ -249,7 +249,7 @@ http://www.gnu.org/software/src-highlite -->

Finally, there are two special match values that can be used. The first is the atom '_' which will match any host or path.

-
@@ -258,7 +258,7 @@ http://www.gnu.org/software/src-highlite -->

The second is the special host match "*" which will match the wildcard path, generally used alongside the OPTIONS method.

-
@@ -291,7 +291,7 @@ Faster compilation strategies could be to compile the routes directly to Erlang code, but would require heavier dependencies.

To compile routes, just call the appropriate function:

-
@@ -313,7 +313,7 @@ http://www.gnu.org/software/src-highlite --> list used by routing. This will apply to all new connections accepted by the listener:

-
@@ -378,6 +378,8 @@ http://www.gnu.org/software/src-highlite --> +
  • 2.3
  • +
  • 2.2
  • 2.1
  • -- cgit v1.2.3