Hi I have in public directory index.php with this code
<?php
use DI\Container;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Factory\AppFactory;
use Slim\Views\Twig;
use Slim\Views\TwigMiddleware;
require __DIR__ . '/../vendor/autoload.php';
$container = new Container();
AppFactory::setContainer($container);
// Set views in Container
$container->set('view', function() {
return Twig::create(__DIR__ . '/../views',
['cache' => __DIR__ . '/../cache']);
});
$app = AppFactory::create();
// Add Twig-View Middleware
$app->add(TwigMiddleware::createFromContainer($app));
$app->get('/about', function ($request, $response) {
return $this->get('view')->render($response, 'profile.twig');
});
$app->get('/', function (Request $request, Response $response, $args) {
$response->getBody()->write("Hello world!");
return $response;
});
$app->run();
homepage route is working but about is not working. Where I have the bug?