示例#1
0
RESPONSE 200 OK 
[
  {
    "id": "1",
    "name": "Lidy Segura",
    "email": "*****@*****.**"
  },
  {
    "id": "2",
    "name": "Edy Segura",
    "email": "*****@*****.**"
  }
]
*/
$app->get('/guests/', function () use($app) {
    $guests = GuestService::listGuests();
    if ($guests) {
        $app->response()->header('Content-Type', 'application/json');
        $app->response()->setStatus(200);
        echo json_encode($guests);
    } else {
        $app->response()->setStatus(204);
    }
});
/*
HTTP DELETE /api/guests/:id
RESPONSE 200 OK 
{
  "status": "true",
  "message": "Guest deleted!"
}