$app->post('/guests/', function () use($app) { $guestJson = $app->request()->getBody(); $newGuest = json_decode($guestJson, true); if ($newGuest) { $guest = GuestService::add($newGuest); echo "Guest {$guest['name']} added on database"; } else { $app->response->setStatus(400); echo "Invalid JSON"; } }); $app->put('/guests/', function () use($app) { $guestJson = $app->request()->getBody(); $updatedGuest = json_decode($guestJson, true); if ($updatedGuest && $updatedGuest['id']) { if (GuestService::update($updatedGuest)) { echo "Guest {$updatedGuest['name']} updated on database"; } else { $app->response->setStatus('404'); echo "Guest not found"; } } else { $app->response->setStatus(400); echo "Invalid JSON"; } }); /* HTTP DELETE /api/guests/:id RESPONSE 200 OK { "status": "true",