forked from filkat34/UEL312_GroupLevel_Microframework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
29 lines (21 loc) · 788 Bytes
/
Copy pathindex.php
File metadata and controls
29 lines (21 loc) · 788 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
<?php
declare(strict_types=1);
require_once __DIR__ . '/vendor/autoload.php';
use Framework312\Router\SimpleRouter;
use Framework312\Template\TwigRenderer;
// Charger les vues de test
require_once __DIR__ . '/tests/views/Homepage.php';
require_once __DIR__ . '/tests/views/TestHTMLView.php';
require_once __DIR__ . '/tests/views/TestJSONView.php';
require_once __DIR__ . '/tests/views/Book.php';
// Créer le moteur de rendu des templates
$engine = new TwigRenderer(__DIR__ . '/templates/');
// Créer le routeur
$router = new SimpleRouter($engine);
// Enregistrer les routes
$router->register('/', 'Homepage');
$router->register('/html', 'TestHTMLView');
$router->register('/json', 'TestJSONView');
$router->register('/book/:id', 'Book');
// Servir la requête
$router->serve();