add chapter 11 solutions

This commit is contained in:
lubiana 2022-05-30 20:40:45 +02:00 committed by Andre Lubian
parent 9b14e32639
commit 350f8e18b9
21 changed files with 1975 additions and 0 deletions

View file

@ -0,0 +1,12 @@
<?php declare(strict_types=1);
use FastRoute\RouteCollector;
use Lubian\NoFramework\Action\Hello;
use Lubian\NoFramework\Action\Other;
use Psr\Http\Message\ResponseInterface;
return function (RouteCollector $r) {
$r->addRoute('GET', '/hello[/{name}]', Hello::class);
$r->addRoute('GET', '/other', [Other::class, 'handle']);
$r->addRoute('GET', '/', fn (ResponseInterface $r) => $r->withHeader('Location', '/hello') ->withStatus(302));
};