-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
39 lines (34 loc) · 968 Bytes
/
index.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
<?php
require "config/connexionDB.php";
require_once __DIR__ . "/helpers/core.php";
require_once __DIR__ . "/helpers/request.php";
$method = $_SERVER['REQUEST_METHOD'];
$url = parse_url($_SERVER['REQUEST_URI']);
$path = $url['path'];
switch ($path) {
case '/delete':
if ($method === 'DELETE') {
require_once __DIR__ . '/controllers/delete.php';
}
break;
case '/getAll':
if ($method === 'GET') {
require_once __DIR__ . '/controllers/getAll.php';
}
break;
case '/getById' :
if($method === 'GET'){
require_once __DIR__ . '/controllers/getById.php';
}
break;
case '/createPost':
if($method === 'POST'){
require_once __DIR__ . '/controllers/createPost.php';
}
break;
case '/update':
if($method === 'PUT'){
require_once __DIR__ . '/controllers/update.php';
}
break;
}