Beispiel #1
0
    echo $res;
});
$app->get('/xml', function () use($app) {
    $db = new DbHandler();
    $res = $db->getxmls();
    //var_dump($res);
    echoResponse(200, $res);
});
$app->get('/xml/:id', function ($id) use($app) {
    $db = new DBHandler();
    $res = $db->getxml($id);
    echoResponse(200, $res);
});
$app->get('/deletexml/:id', function ($id) use($app) {
    $db = new DBHandler();
    $res = $db->deletexml($id);
    echoResponse(200, $res);
});
$app->post('/newcomment', function () use($app) {
    $json = $app->request->getBody();
    $input = json_decode($json, true);
    $id = $input['id'];
    $author = $input['author'];
    $comment = $input['comment'];
    $db = new DbHandler();
    $res = $db->addcomment($id, $author, $comment);
    echo $res;
});
$app->get('/comment/:id', function ($id) use($app) {
    $db = new DBHandler();
    $res = $db->getcomment($id);