MAPG-10 adapt index.php to the new view-controller concept

add GetNewPosition's route to index.php
This commit is contained in:
Bence Pőcze 2020-05-19 03:19:23 +02:00
parent 88e8a4e9e4
commit e0d65b6e27

View File

@ -8,9 +8,16 @@ switch($url) {
case '/': case '/':
$controller = new MapGuesser\Controller\GuessController(); $controller = new MapGuesser\Controller\GuessController();
break; break;
case '/getNewPosition.json':
$controller = new MapGuesser\Controller\GetNewPosition();
break;
default: default:
echo 'Error 404'; echo 'Error 404';
die; die;
} }
echo $controller->render(); $view = $controller->run();
header('Content-Type: ' . $view->getContentType() . '; charset=UTF-8');
echo $view->render();