-
Notifications
You must be signed in to change notification settings - Fork 2
/
Route.php
executable file
·38 lines (34 loc) · 1.33 KB
/
Route.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/**
* Skeleton application for SimpleMVC
*
* @link http://github.com/simplemvc/skeleton
* @copyright Copyright (c) Enrico Zimuel (https://www.zimuel.it)
* @license https://opensource.org/licenses/MIT MIT License
*/
declare(strict_types=1);
namespace App\Config;
use App\Controller;
use App\Controller\Admin;
use SimpleMVC\Controller\BasicAuth;
class Route
{
public const LOGIN = '/login';
public const LOGOUT = '/logout';
public const DASHBOARD = '/admin/users';
public static function getRoutes(): array
{
return [
[ 'GET', '/', Controller\Home::class ],
[ 'GET', '/hello[/{name}]', Controller\Hello::class ],
[ ['GET', 'POST'], self::LOGIN, Controller\Login::class ],
[ 'GET', self::LOGOUT, Controller\Logout::class ],
[ 'GET', '/basic-auth', [BasicAuth::class, Controller\Secret::class]],
// Admin section
[ 'GET', '/admin/users[/{id}]', [Controller\AuthSession::class, Admin\Users\Read::class]],
[ 'POST', '/admin/users/{id}', [Controller\AuthSession::class, Admin\Users\Update::class]],
[ 'POST', '/admin/users', [Controller\AuthSession::class, Admin\Users\Create::class]],
[ 'DELETE', '/admin/users/{id}', [Controller\AuthSession::class, Admin\Users\Delete::class]],
];
}
}