$response["message"] = "Comment added successfully"; $response["comment_id"] = $result; echoResponse(200, $response); } }); /** * Listing last added places * url /lastAddedPlaces * method GET * Will return 404 if the are any place */ $app->get('/lastAddedPlaces', function () { $response = array(); $db = new db_handler(); // fetch task $result = $db->getLastAddedPlaces(); if ($result != NULL) { $response["error"] = false; $response["places"] = $result; echoResponse(200, $response); } else { $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