website/app/routes/apiv1/music.php

20 lines
360 B
PHP
Raw Normal View History

<?php
2016-11-28 18:08:54 -05:00
// retrieve album info
$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();
if ($album) {
echo json_encode($album);
} else {
2016-11-28 18:08:54 -05:00
$app->notFound();
}
})->name('apiv1.music.get-album');