-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
34 lines (25 loc) · 941 Bytes
/
index.php
File metadata and controls
34 lines (25 loc) · 941 Bytes
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
<?php
use App\Controllers\AuthController;
use App\Controllers\HomeController;
use App\Controllers\RegisterController;
use App\Wrappers\Env;
use App\Wrappers\Session;
require __DIR__ . '/vendor/autoload.php';
// Parse .env file
Env::parse(__DIR__ . '/.env');
// Start session
Session::start();
$router = new \Bramus\Router\Router();
$router->get('/', [HomeController::class, 'index']);
$router->post('/', [HomeController::class, 'post']);
$router->mount('/register', function() use ($router) {
$router->get('/', [RegisterController::class, 'index']);
$router->post('/', [RegisterController::class, 'post']);
});
$router->mount('/login', function () use ($router) {
$router->get('/', [AuthController::class, 'index']);
$router->post('/', [AuthController::class, 'post']);
});
$router->get('/logout', [AuthController::class, 'logout']);
$router->get('/dashboard', [AuthController::class, 'dashboard']);
$router->run();