In my high school had programming classes, not so properly to learn something, them the programming teacher, only told the less than basic about REST API, to operate with databases. This way, i saw a new and simple way to solve the problem with REST, the way was use only post.
I saw problems, with get, pass params in the path, was very insecurity. And i wasn't to expose the php file so directly, and wasn't create multiple endpoint, then edits them.
A Example Below:
$data = json_decode(file_get_contents("php://input"), true) ?? $_POST;
if(isset($data['Operation'])){
$WhoOperation = $data['Operation'];
$content = $data['Content'];
switch ($WhoOperation) {
case 'select':
SelectAllEmpresas($conn);
break;
case 'VerifyAccount':
getUser($conn, $content);
break;
case 'selectUsers':
SelectUser($conn,$content);
break;
case 'addUser':
addUser($conn,$content);
break;
case 'deleteUser':
deleteUser($conn,$content);
break;
case 'alterUser':
alterUser($conn,$content);
break;
default:
error404();
}
}else{
error404();
}
Above, had all the operations of an CRUD, only with posts. Only when i learned more about API, and discussing with friends, i named it POSTfull. It's a predecessor of GraphQL, i think, actually. I was very funny this code today.