Updated the album info retrieval api
This commit is contained in:
parent
85e434dd83
commit
1c9a802a3c
@ -1,14 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// music design #1
|
// retrieve album info
|
||||||
$app->get('/apiv1/music/get-album/:albumid', function($albumid) use($app) {
|
$app->get('/apiv1/music/album-info/:albumid', function($albumid) use($app) {
|
||||||
|
|
||||||
|
if (!ctype_digit($albumid)) {
|
||||||
|
echo 'Don\'t do that';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$album = $app->album->where('id', $albumid)->first();
|
$album = $app->album->where('id', $albumid)->first();
|
||||||
|
|
||||||
if ($album) {
|
if ($album) {
|
||||||
echo json_encode($album);
|
echo json_encode($album);
|
||||||
} else {
|
} else {
|
||||||
echo 'Not found';
|
$app->notFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
})->name('apiv1.music.get-album');
|
})->name('apiv1.music.get-album');
|
||||||
|
Loading…
Reference in New Issue
Block a user