Update: 2026-05-03 20:23:16

This commit is contained in:
Hamza-Ayed
2026-05-03 20:23:16 +03:00
parent fdd850e3af
commit f78c8f5864

View File

@@ -12,13 +12,21 @@ $uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$route = $_GET['route'] ?? str_replace('/api/', '', $uri);
$route = trim($route, '/');
// Log for debugging
error_log("Router: Resolved route for URI '{$uri}' is '{$route}'");
// Mapping routes to modules
$routes = [
'auth/login' => 'auth/login.php',
'auth/refresh' => 'auth/refresh.php',
'auth/logout' => 'auth/logout.php',
'users' => 'users/index.php',
'trips' => 'trips/index.php',
'auth/login' => 'auth/login.php',
'v1/auth/login' => 'auth/login.php',
'auth/refresh' => 'auth/refresh.php',
'v1/auth/refresh' => 'auth/refresh.php',
'auth/logout' => 'auth/logout.php',
'v1/auth/logout' => 'auth/logout.php',
'users' => 'users/index.php',
'v1/users' => 'users/index.php',
'trips' => 'trips/index.php',
'v1/trips' => 'trips/index.php',
];
if (isset($routes[$route])) {