'auth/login.php', 'v1/auth/refresh' => 'auth/refresh.php', 'v1/auth/logout' => 'auth/logout.php', 'v1/users' => 'users/index.php', ]; if (isset($routes[$route])) { $file = APP_PATH . '/modules_app/' . $routes[$route]; if (file_exists($file)) { require_once $file; } else { json_error("Endpoint file missing: {$route}", 500); } } else { // If no route matches, maybe it's a SPA request or 404 if (str_starts_with($route, 'v1/')) { json_error("Not Found: {$route}", 404); } else { // Not an API request — serve the SPA shell include __DIR__ . '/shell.php'; exit; } }