Added an api method to get album info by name

This commit is contained in:
Gregory Ballantine 2016-11-28 17:06:04 -05:00
parent 42de8819a8
commit f2ca6af5bc
2 changed files with 17 additions and 0 deletions

View File

@ -7,3 +7,6 @@ require 'routes/contact.php';
require 'routes/home.php';
require 'routes/music.php';
require 'routes/shows.php';
// API routes
require 'routes/apiv1/music.php';

View File

@ -0,0 +1,14 @@
<?php
// music design #1
$app->get('/apiv1/music/get-album/:albumid', function($albumid) use($app) {
$album = $app->album->where('id', $albumid)->first();
if ($album) {
echo json_encode($album);
} else {
echo 'Not found';
}
})->name('apiv1.music.get-album');