<?php
// Set JSON content type
header('Content-Type: application/json');

// Get the request path
$requestUri = $_SERVER['REQUEST_URI'];
$path = parse_url($requestUri, PHP_URL_PATH);
$pathParts = explode('/', trim($path, '/'));
$endpoint = end($pathParts);

// Check which API endpoint was requested
switch ($endpoint) {
    case 'getsettings':
        // Include the getsettings API file
        include_once '../api/getsettings.php';
        break;

    case 'addmessege':
        // Include the addmessege API file
        include_once '../api/addmessege.php';
        break;

    case 'addallmessege':
        // Include the addallmessege API file
        include_once '../api/addallmessege.php';
        break;

    default:
        // Return error for unknown endpoint
        http_response_code(404);
        echo json_encode(['error' => 'API endpoint not found']);
}
?>
