diff --git a/src/controllers/api/Products.php b/src/controllers/api/Products.php index 8ed792c..1b1f78d 100644 --- a/src/controllers/api/Products.php +++ b/src/controllers/api/Products.php @@ -21,14 +21,37 @@ private function getProducts(): void echo json_encode($result); } + private function addProduct(): void + { + } + + private function deleteProduct(): void + { + } + + private function updateProduct(): void + { + } + + public function index(): void { switch ($_SERVER['REQUEST_METHOD']) { case 'GET': $this->getProducts(); break; + case 'POST': + $this->addProduct(); + break; + case 'DELETE': + $this->deleteProduct(); + break; + case 'PUT': + $this->updateProduct(); + break; default: - echo json_encode("Error"); + http_response_code(400); + die(); } } } \ No newline at end of file