Update the controllers and set up some routes

This commit is contained in:
Dave Smith-Hayes 2024-05-15 22:15:24 -04:00
parent c1d2651879
commit 5cfb45dd7e
3 changed files with 5 additions and 3 deletions

View File

@ -69,7 +69,8 @@ class Bootstrap
$app->addErrorMiddleware(true, true, true); $app->addErrorMiddleware(true, true, true);
// Twig // Twig
$twig = Twig::create(__DIR__ . "../templates", [ 'cache' => false ]); $templatePath = __DIR__ . "/../templates";
$twig = Twig::create($templatePath, [ 'cache' => false ]);
$app->add(TwigMiddleware::create($app, $twig)); $app->add(TwigMiddleware::create($app, $twig));
} }

View File

@ -3,11 +3,10 @@
namespace Slovocast\Controller; namespace Slovocast\Controller;
use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class HomePage extends Controller class HomePage extends Controller
{ {
public function respond(Request $request, Response $response): Response public function respond(): Response
{ {
return $this->render('home'); return $this->render('home');
} }

View File

@ -3,6 +3,7 @@
namespace Slovocast; namespace Slovocast;
use Slim\App; use Slim\App;
use Slovocast\Controller\HomePage;
use Slovocast\Controller\User\{ use Slovocast\Controller\User\{
RegisterUserPage, RegisterUserPage,
RegisterUserAction RegisterUserAction
@ -12,6 +13,7 @@ class Routes
{ {
public static function init(App $app): void public static function init(App $app): void
{ {
$app->get('/', HomePage::class);
// User Routes // User Routes
self::users($app); self::users($app);
} }