-
Notifications
You must be signed in to change notification settings - Fork 0
/
app_router.php
69 lines (67 loc) · 2.08 KB
/
app_router.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
/*
Rutas para Assets
*/
if(strstr($_SERVER['REQUEST_URI'],'assets/')!=FALSE){
$resource = str_replace('assets/','',$_SERVER['REQUEST_URI']);
if (preg_match('/\.css|\.js|\.jpg|\.png|\.map$/', $resource, $match)) {
$mimeTypes = [
'.css' => 'text/css',
'.js' => 'application/javascript',
'.jpg' => 'image/jpg',
'.png' => 'image/png',
'.map' => 'application/json'
];
$path = __DIR__ ."/App/Public". $resource;
if (is_file($path)) {
header("Content-Type: {$mimeTypes[$match[0]]}");
require $path;
die();
}
}
}
if(isset($_SERVER['QUERY_STRING'])){
$request = str_replace($_SERVER['QUERY_STRING'],'',$_SERVER['REQUEST_URI']);
}else{
$request = $_SERVER['REQUEST_URI'];
}
switch ($request) {
case '/' :
require __DIR__ . '/App/Views/login.php';
break;
case '' :
require __DIR__ . '/App/Views/login.php';
break;
case '/Login' :
require __DIR__ . '/App/Views/login.php';
break;
case '/Home' :
require __DIR__ . '/App/index.php';
break;
case '/login/makeLogin':
require __DIR__ . '/App/index.php';
break;
case '/login/logOut':
require __DIR__ . '/App/index.php';
break;
case '/user/newUser':
require __DIR__ . '/App/index.php';
break;
case '/user/editUser/?':
require __DIR__ . '/App/index.php';
break;
case '/user/createUser':
require __DIR__ . '/App/index.php';
break;
case '/user/deleteUser/?':
require __DIR__ . '/App/index.php';
break;
case '/user/updateUser':
require __DIR__ . '/App/index.php';
break;
default:
http_response_code(404);
require __DIR__ . '/App/Views/404.php';
break;
}
?>