Commit a1a61fd1 authored by Andrew M's avatar Andrew M

Change the order of routes.

The note below suggests adding more generic routes at the bottom
as the first matching route is used.

In my opinion the code block should also follow this suggestion
as it makes more clear how to use routes.
parent ddcec079
...@@ -255,10 +255,6 @@ methods on your application: ``get``, ``post``, ``put``, ``delete``:: ...@@ -255,10 +255,6 @@ methods on your application: ``get``, ``post``, ``put``, ``delete``::
You can also call ``match``, which will match all methods. This can be You can also call ``match``, which will match all methods. This can be
restricted via the ``method`` method:: restricted via the ``method`` method::
$app->match('/blog', function () {
...
});
$app->match('/blog', function () { $app->match('/blog', function () {
... ...
}) })
...@@ -269,6 +265,10 @@ restricted via the ``method`` method:: ...@@ -269,6 +265,10 @@ restricted via the ``method`` method::
}) })
->method('PUT|POST'); ->method('PUT|POST');
$app->match('/blog', function () {
...
});
.. note:: .. note::
The order in which the routes are defined is significant. The first The order in which the routes are defined is significant. The first
...@@ -462,7 +462,7 @@ the defaults for new controllers. ...@@ -462,7 +462,7 @@ the defaults for new controllers.
.. note:: .. note::
The global configuration does not apply to controller providers you might The global configuration does not apply to controller providers you might
mount as they have their own global configuration (read the mount as they have their own global configuration (read the
:doc:`dedicated chapter<organizing_controllers>` for more information). :doc:`dedicated chapter<organizing_controllers>` for more information).
Error handlers Error handlers
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment