move response logic to new view controller
This commit is contained in:
parent
59a8fc5164
commit
394b8d890c
2 changed files with 16 additions and 5 deletions
|
|
@ -5,6 +5,7 @@ use Psr\Http\Message\ServerRequestInterface as Request;
|
|||
use DI\Bridge\Slim\Bridge;
|
||||
use Slim\Views\Twig;
|
||||
use Slim\Views\TwigMiddleware;
|
||||
use App\View\ViewController;
|
||||
|
||||
$container = require __DIR__.'/container.php';
|
||||
$app = Bridge::create($container);
|
||||
|
|
@ -14,10 +15,6 @@ $app->add(TwigMiddleware::create($app, $container->get(Twig::class)));
|
|||
// change first param to false for production
|
||||
$app->addErrorMiddleware(true, true, true);
|
||||
|
||||
$app->get('/admin', function (Response $response, Twig $twig) {
|
||||
return $twig->render($response, 'admin.html.twig', [
|
||||
'name' => 'John',
|
||||
]);
|
||||
});
|
||||
$app->get('/admin', [ViewController::class, 'admin']);
|
||||
|
||||
return $app;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue