<?php

$app->get('/shows', function() use($app) {

	$shows = json_decode(file_get_contents('http://api.bandsintown.com/artists/HALFtone/events.json?api_version=2.0&app_id=shows_halftoneband.com'));

	foreach ($shows as $show) {
		$show->date = date('M dS', strtotime($show->datetime));
		$show->day = date('D', strtotime($show->datetime));
		$show->time = date('H:i', strtotime($show->datetime));
	}

	$app->render('pages/shows.twig', [
		'shows' => $shows,
	]);

})->name('shows');

$app->get('/shows/json', function() use($app) {

	$shows = json_decode(file_get_contents('http://api.bandsintown.com/artists/HALFtone/events.json?api_version=2.0&app_id=shows_halftoneband.com'));

	foreach ($shows as $show) {
		$show->date = date('M dS', strtotime($show->datetime));
		$show->day = date('D', strtotime($show->datetime));
		$show->time = date('H:i', strtotime($show->datetime));
		print_r($show);
		echo '<br /><br />';
	}
	die();

})->name('shows.json');
