示例#1
0
    $album_controller = new AlbumController();
    echo json_encode($album_controller->listAlbumslimit($limit));
});
/***** get Album ***/
Flight::route('GET /album/@id', function ($id) {
    $album_controller = new AlbumController();
    $album = $album_controller->getAlbum($id);
    echo json_encode($album);
});
/***** ADD / UPDATE Album ***/
Flight::route('PUT /albums', function () {
    $request = Flight::request();
    $album_controller = new AlbumController();
    $album = json_decode($request->body);
    if (!isset($album->ID)) {
        echo json_encode($album_controller->ajouterAlbum($album));
    } else {
        echo json_encode($album_controller->modifierAlbum($album));
    }
});
/***** Delete Album ***/
Flight::route('DELETE /album/@id', function ($id) {
    $album_controller = new AlbumController();
    $response = $album_controller->deleteAlbum($id);
    echo json_encode($response);
});
/*
****************
**************** Tracks
****************
*/