$response["message"] = "Score added successfully"; $response["score_id"] = $result; echoResponse(200, $response); } }); /** * Listing comments * url /comments/:id * method GET * Will return 404 if the are any comment */ $app->get('/comments/:id', function ($place_id) { $response = array(); $db = new db_handler(); // fetch task $result = $db->getCommentsByPlaceId($place_id); if ($result != NULL) { $response["error"] = false; $response["comments"] = $result; echoResponse(200, $response); } else { $response["error"] = true; $response["message"] = "The requested place doesn't have any comment"; echoResponse(404, $response); } }); /** * Comment Registration * url - /comment * method - POST * params - place_id, comment