24 lines
658 B
PHP
24 lines
658 B
PHP
|
<?php
|
||
|
|
||
|
define('SRC', __DIR__ . '/../src');
|
||
|
require_once SRC . '/bootstrap.php';
|
||
|
|
||
|
$r = [];
|
||
|
|
||
|
router_get($r, '/', function () {
|
||
|
echo render('layouts/basic', ['view' => 'pages/home']);
|
||
|
});
|
||
|
|
||
|
router_get($r, '/auth/register', 'auth_register_get');
|
||
|
router_post($r, '/auth/register', 'auth_register_post');
|
||
|
router_get($r, '/auth/login', 'auth_login_get');
|
||
|
router_post($r, '/auth/login', 'auth_login_post');
|
||
|
router_post($r, '/auth/logout', 'auth_logout');
|
||
|
|
||
|
// [code, handler, params]
|
||
|
$l = router_lookup($r, $_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI']);
|
||
|
|
||
|
if ($l['code'] !== 200) router_error($l['code']);
|
||
|
$l['handler'](...$l['params'] ?? []);
|
||
|
clear_flashes();
|