*/ $app->post('/place', function () use($app) { verifyRequiredParams(array('name', 'description', 'address', 'lat', 'lng', 'author', 'email')); $response = array(); // reading post params $name = $app->request->post('name'); $description = $app->request->post('description'); $address = $app->request->post('address'); $lat = $app->request->post('lat'); $lng = $app->request->post('lng'); $author = $app->request->post('author'); $email = $app->request->post('email'); validateGeolocation($lat, $lng); validateEmail($email); $db = new db_handler(); $result = $db->addPlace($name, $description, $address, $lat, $lng, $author, $email); if (!$result) { $response["error"] = true; $response["message"] = "Sorry, an error has occurred adding the place"; echoResponse(400, $response); } else { $response["error"] = false; $response["message"] = "Place added successfully"; $response["place_id"] = $result; echoResponse(200, $response); } }); /** * Listing score * url /place/:id * method GET