-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
56 lines (35 loc) · 888 Bytes
/
Copy pathindex.php
File metadata and controls
56 lines (35 loc) · 888 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
// https://www.youtube.com/watch?v=2_dqDpSSpsc
declare ( strict_types =1 );
require_once ('router.php'); // instead of composer
require_once ('authorController.php');
//use App;
$router = new router();
$router->get("/", function (){
require_once 'authors.html';
});
$router->get('/about', function (){
echo 'about page';
});
$router->get('/author', function (){
require_once 'author.html';
});
$router->get('/authorg', function ($id){
authorController::author($id['id']);
});
$router->get('/authors', function (){
authorController::authors();
});
$router->post('/authorp', function ($author){
// echo var_dump($author['au']);
$a = json_decode($author['au']);
echo $a->id;
authorController::updateAuthor($a);
});
$router->addNotFoundHandler( function ()
{
require_once '404.html';
}
);
$router->run();
?>