Esempio n. 1
0
        $response["error"] = true;
        $response["message"] = "There are not recent places";
        echoResponse(404, $response);
    }
});
/**
 * Get the total number of places
 * url /numberOfPlaces
 * method GET
 * Will return 404 if the are not any place
 */
$app->get('/numberOfPlaces', function () {
    $response = array();
    $db = new db_handler();
    // fetch task
    $result = $db->getNumberOfPlaces();
    if ($result != NULL) {
        $response["error"] = false;
        $response["number_of_places"] = $result["COUNT(*)"];
        echoResponse(200, $response);
        $response["error"] = true;
    } else {
        $response["message"] = "The are not any place";
        echoResponse(404, $response);
    }
});
/**
 * Most visited places
 * url /topVisitedPlaces
 * method GET
 * Will return 404 if the are any place