Beispiel #1
0
});
$app->delete('/api/users/:id', function ($id) {
    $cn = new Users();
    $cn->deleteUser($id);
});
$app->get('/api/users/:id/suggestions', function ($id) {
    $cn = new Suggestions();
    $cn->getSuggestionsByUser($id);
});
$app->get('/api/suggestions/', function () {
    $cn = new Suggestions();
    $cn->getSuggestions();
});
$app->get('/api/suggestions/:id', function ($id) {
    $cn = new Suggestions();
    $cn->getSuggestionsByID($id);
});
$app->post('/api/suggestions/', function () use($app) {
    $req = $app->request();
    $bdy = $req->getBody();
    $suggestion = json_decode($bdy);
    $cn = new Suggestions();
    $cn->insertSuggestion($suggestion[0]);
});
$app->put('/api/suggestions/:id', function ($id) use($app) {
    $req = $app->request();
    $bdy = $req->getBody();
    $suggestion = json_decode($bdy);
    $cn = new Suggestions();
    $cn->updateSuggestion($id, $suggestion[0]);
});