From 5cfb45dd7e1e47dd5f61206d695fa58b95a13938 Mon Sep 17 00:00:00 2001 From: Dave Smith-Hayes Date: Wed, 15 May 2024 22:15:24 -0400 Subject: [PATCH] Update the controllers and set up some routes --- code/src/Bootstrap.php | 3 ++- code/src/Controller/HomePage.php | 3 +-- code/src/Routes.php | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/code/src/Bootstrap.php b/code/src/Bootstrap.php index 2f366d8..37f2637 100644 --- a/code/src/Bootstrap.php +++ b/code/src/Bootstrap.php @@ -69,7 +69,8 @@ class Bootstrap $app->addErrorMiddleware(true, true, true); // Twig - $twig = Twig::create(__DIR__ . "../templates", [ 'cache' => false ]); + $templatePath = __DIR__ . "/../templates"; + $twig = Twig::create($templatePath, [ 'cache' => false ]); $app->add(TwigMiddleware::create($app, $twig)); } diff --git a/code/src/Controller/HomePage.php b/code/src/Controller/HomePage.php index 3081b73..f43657b 100644 --- a/code/src/Controller/HomePage.php +++ b/code/src/Controller/HomePage.php @@ -3,11 +3,10 @@ namespace Slovocast\Controller; use Psr\Http\Message\ResponseInterface as Response; -use Psr\Http\Message\ServerRequestInterface as Request; class HomePage extends Controller { - public function respond(Request $request, Response $response): Response + public function respond(): Response { return $this->render('home'); } diff --git a/code/src/Routes.php b/code/src/Routes.php index fcd6c42..7cda3f5 100644 --- a/code/src/Routes.php +++ b/code/src/Routes.php @@ -3,6 +3,7 @@ namespace Slovocast; use Slim\App; +use Slovocast\Controller\HomePage; use Slovocast\Controller\User\{ RegisterUserPage, RegisterUserAction @@ -12,6 +13,7 @@ class Routes { public static function init(App $app): void { + $app->get('/', HomePage::class); // User Routes self::users($app); }