mirror of
https://github.com/sigmasternchen/drnk.me
synced 2025-03-15 17:58:54 +00:00
19 lines
492 B
PHP
19 lines
492 B
PHP
![]() |
<?php
|
||
|
|
||
|
require_once(ROOT . "/router/Router.php");
|
||
|
|
||
|
function fromController(string $path, string $endpoint = null) {
|
||
|
return function(array &$context) use ($path, $endpoint) {
|
||
|
if ($endpoint)
|
||
|
$context[ENDPOINT] = $endpoint;
|
||
|
|
||
|
return (require(ROOT . "/controllers/" . $path . ".php"))($context);
|
||
|
};
|
||
|
}
|
||
|
|
||
|
return function(Router $router) {
|
||
|
$router->addRoute(GET, "/", fromController("/GET"));
|
||
|
|
||
|
$router->addRoute(GET, "/.*", fromController("/slug/GET"));
|
||
|
};
|