From fcad6cf07589d76e026a08565a34027720c648bf Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Wed, 27 Jan 2016 08:23:44 -0600 Subject: [PATCH] Updated standalone example to pipe routing/dispatch middleware --- doc/book/getting-started/standalone.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/doc/book/getting-started/standalone.md b/doc/book/getting-started/standalone.md index db1eaac1..5397900b 100644 --- a/doc/book/getting-started/standalone.md +++ b/doc/book/getting-started/standalone.md @@ -67,6 +67,8 @@ $app->get('/', function ($request, $response, $next) { return $response; }); +$app->pipeRoutingMiddleware(); +$app->pipeDispatchMiddleware(); $app->run(); ``` @@ -77,6 +79,21 @@ $app->run(); > your bootstrap is invoked for unknown URLs. We'll cover that in a later > chapter. +> ### Routing and dispatching +> +> Note the lines from the above: +> +> ```php +> $app->pipeRoutingMiddleware(); +> $app->pipeDispatchMiddleware(); +> ``` +> +> Expressive's `Application` class provides two separate middlewares, one for +> routing, and one for dispatching middleware matched by routing. This allows +> you to slip in validations between the two activities if desired. They are +> not automatically piped to the application, however, to allow exactly that +> situation, which means they must be piped manually. + ## 5. Start a web server Since we're just testing out the basic functionality of our application, we'll