protected function handle_GET_request($request) { $path = $request->request_path(); $path_length = count($path); if (isset($path[0]) && $path[0] === "products") { if ($path_length === 2 && isset($path[1])) { $db = new SQLConnector(); return $db->get_product($path[1]); } else { if ($path_length === 1) { // get all products $db = new SQLConnector(); return $db->get_products(); } else { // invalid path return false; } } } else { return false; } }