aboutsummaryrefslogtreecommitdiffstats
path: root/doc/src/guide
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/guide')
-rw-r--r--doc/src/guide/routing.ezdoc26
1 files changed, 8 insertions, 18 deletions
diff --git a/doc/src/guide/routing.ezdoc b/doc/src/guide/routing.ezdoc
index e7b43f2..2482c12 100644
--- a/doc/src/guide/routing.ezdoc
+++ b/doc/src/guide/routing.ezdoc
@@ -191,26 +191,16 @@ HostMatch = "*".
After the matching has completed, the resulting bindings can be tested
against a set of constraints. Constraints are only tested when the
binding is defined. They run in the order you defined them. The match
-will succeed only if they all succeed.
+will succeed only if they all succeed. If the match fails, then Cowboy
+tries the next route in the list.
-They are always given as a two or three elements tuple, where the first
-element is the name of the binding, the second element is the constraint's
-name, and the optional third element is the constraint's arguments.
+The format used for constraints is the same as match functions in
+`cowboy_req`: they are provided as a list of fields which may have
+one or more constraints. While the router accepts the same format,
+it will skip fields with no constraints and will also ignore default
+values, if any.
-The following constraints are currently defined:
-
-* {Name, int}
-* {Name, function, fun ((Value) -> true | {true, NewValue} | false)}
-
-The `int` constraint will check if the binding is a binary string
-representing an integer, and if it is, will convert the value to integer.
-
-The `function` constraint will pass the binding value to a user specified
-function that receives the binary value as its only argument and must
-return whether it fulfills the constraint, optionally modifying the value.
-The value thus returned can be of any type.
-
-Note that constraint functions SHOULD be pure and MUST NOT crash.
+Read more about ^constraints^.
:: Compilation