34 lines
940 B
PHP
34 lines
940 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* Uruk International Prize - Root Router & Gateway Proxy
|
|
* Supports both direct server document root and /backend/public dispatching.
|
|
*/
|
|
|
|
$uri = parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH);
|
|
|
|
// 1. If requesting the feasibility presentation or homepage in browser
|
|
if ($uri === '/' || $uri === '/feasibility' || $uri === '/docs') {
|
|
$htmlDoc = __DIR__ . '/docs/uruk_project_feasibility_and_architecture.html';
|
|
if (file_exists($htmlDoc)) {
|
|
header('Content-Type: text/html; charset=UTF-8');
|
|
readfile($htmlDoc);
|
|
exit;
|
|
}
|
|
}
|
|
|
|
// 2. Dispatch all API routes and gateway endpoints to backend/public/index.php
|
|
$backendIndex = __DIR__ . '/backend/public/index.php';
|
|
if (file_exists($backendIndex)) {
|
|
require_once $backendIndex;
|
|
exit;
|
|
}
|
|
|
|
http_response_code(404);
|
|
echo json_encode([
|
|
'success' => false,
|
|
'error' => 'Core Backend Engine not found.',
|
|
]);
|