File: /home/u5264046/public_html/abdhannan_codes/templates/index.php
<?php
// Include configuration (if needed)
require_once 'config.php';
// Include logic for fetching templates
require_once 'templates.php';
// Route requests based on URL path
$route = explode('/', parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
switch ($route[1]) {
case 'templates':
$templates = get_templates(); // Call your function to fetch templates
header('Content-Type: application/json');
echo json_encode($templates);
break;
default:
header('HTTP/1.1 404 Not Found');
echo '404 Not Found';
}