'ok', 'time' => time() ]); exit; } // Contoh endpoint: Login if ($_SERVER['REQUEST_METHOD'] === 'POST' && strpos($_SERVER['REQUEST_URI'], '/auth/v1/login') !== false) { // Parse request body $input = json_decode(file_get_contents('php://input'), true); // Validasi if (!isset($input['username']) || !isset($input['password'])) { http_response_code(422); echo json_encode([ 'error' => 'validation_error', 'message' => 'Username and password are required' ]); exit; } // TODO: Implementasi login logic di sini // Contoh response: echo json_encode([ 'success' => true, 'data' => [ 'token' => 'example_token_here', 'expires_in' => 3600, 'user' => [ 'id' => 1, 'username' => $input['username'], 'role' => 'admin' ] ], 'timestamp' => time() ]); exit; } // 404 jika endpoint tidak ditemukan http_response_code(404); echo json_encode([ 'error' => 'not_found', 'message' => 'Endpoint not found' ]);