Trying to set up a php server, To-Dolist app with typescript. help please
Can someone explain to me what the code below is doing or how I'm supposed to use it. As I understand it, its like making an own server. Its for a school project, Im trying to build a To-Dolist with Typescript. <?php /* service.php */ date_default_timezone_set("Europe/Stockholm"); define('DB_HOST', 'localhost'); define('DB_NAME', 'todo'); define('DB_USER', 'root'); define('DB_PASS', 'segdeg'); require_once "db.inc"; require_once "todo.inc"; //require_once "DBBase.class"; $method = $_SERVER['REQUEST_METHOD']; if ($method == 'POST') { $json = file_get_contents('php://input'); $data = json_decode($json); $todoObj = new Todo(DB_HOST, DB_NAME, DB_USER, DB_PASS); if ($data->_action == "GetList") { $result = $todoObj->GetList(); print_r($result); } else if ($data->_action == "Get") { $result = $todoObj->Get($data); print_r($result); } else if ($data->_action == "Insert") { $result = $todoObj->Insert($data); print_r($result); } else if ($data->_action == "Update") { $result = $todoObj->Update($data); print_r($result); } else { die("wrong call"); } /* $class = $data->_group . 'Class'; require_once 'class/' . $data->_group . '.class'; $api = new $class(DB_SECURITY_HOST, DB_SECURITY_NAME, DB_SECURITY_USER, DB_SECURITY_PASS, $text); echo $api->Run($data); */ } else { die('NOT ALLOWED METHOD: ' . $method ); } ?>