$response = $album_controller->recherche($q); echo json_encode($response); }); /***** get Albums ***/ Flight::route('GET /albums', function () { $album_controller = new AlbumController(); echo json_encode($album_controller->listAlbums()); }); Flight::route('GET /albums/limit/@limit', function ($limit) { $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) {