added 404 support
This commit is contained in:
parent
582698a8d0
commit
b60d9481ab
|
@ -22,6 +22,11 @@ class Router
|
|||
{
|
||||
private array $routes;
|
||||
|
||||
public function __construct(private readonly Template $template)
|
||||
{
|
||||
// empty body
|
||||
}
|
||||
|
||||
/*
|
||||
* This method takes a route like /admin/users/{user} and creates a regex to match on call
|
||||
* More complex routes as /posts/{thread}/show/{page} are supported as well.
|
||||
|
@ -47,7 +52,6 @@ class Router
|
|||
|
||||
/*
|
||||
* Check if there is a known route and executes the callback.
|
||||
* Currently no 404 handling.
|
||||
*/
|
||||
public function handleRouting(): void
|
||||
{
|
||||
|
@ -66,7 +70,7 @@ class Router
|
|||
return;
|
||||
}
|
||||
}
|
||||
// Throw a 404 result later …
|
||||
die("Invalid route: $requestUri");
|
||||
$this->template->render(templateName: 'status/404.html.php');
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue