Exemplo n.º 1
0
    $cn->updateSuggestion($id, $suggestion[0]);
});
$app->delete('/api/suggestions/:id', function ($id) {
    $cn = new Suggestions();
    $cn->deleteSuggestion($id);
});
$app->get('/api/locations/', function () {
    $cn = new Locations();
    $cn->getLocations();
});
$app->post('/api/locations/', function () use($app) {
    $req = $app->request();
    $bdy = $req->getBody();
    $location = json_decode($bdy);
    $cn = new Locations();
    $cn->insertLocation($locaiton[0]);
});
$app->get('/api/locations/:id', function ($id) {
    $cn = new Locations();
    $cn->getLocationById($id);
});
$app->put('/api/locations/:id', function ($id) use($app) {
    $req = $app->request();
    $bdy = $req->getBody();
    $contact = json_decode($bdy);
    $cn = new Locations();
    $cn->updateLocation($id, $location[0]);
});
$app->delete('/api/locations/:id', function ($id) {
    $cn = new Locations();
    $cn->deleteLocation($id);