Goal-Calibration/bootstrap/app.php

23 lines
614 B
PHP

<?php
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use DI\Bridge\Slim\Bridge;
use Slim\Views\Twig;
use Slim\Views\TwigMiddleware;
$container = require __DIR__.'/container.php';
$app = Bridge::create($container);
$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',
]);
});
return $app;