CustomerRewardsRESTAPI/index.php

42 lines
1.2 KiB
PHP
Raw Normal View History

2024-04-15 11:38:59 -05:00
<?php
header("Content-Type: application/json");
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/EmptyPHP.php to edit this template
*/
/* USAGE
* https://localhost/index.php/{MODULE_NAME}/{METHOD_NAME}?limit={LIMIT_VALUE}
* http://localhost/index.php/customer/process/list?limit=20
*/
require __DIR__ . "/include/bootstrap.php";
$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$uri = explode( '/', $uri );
if (!isset($uri[2]) || !isset($uri[3]) || !isset($uri[4])) {
header("HTTP/1.1 404 Not Found");
exit();
}
switch($uri[2]) {
case "purchase":
header("HTTP/1.1 404 Module Not Defined");
exit();
//require PROJECT_ROOT_PATH . "/Controller/Api/PurchaseController.php";
//$objFeedController = new PurchaseController();
break;
case "customer":
require PROJECT_ROOT_PATH . "/Controller/Api/CustomerController.php";
$objFeedController = new CustomerController();
break;
default:
header("HTTP/1.1 404 Module Not Found");
exit();
break;
}
$strMethodName = $uri[3] . 'Action';
$objFeedController->{$strMethodName}();