public function RegisterRestUri($app) { $app->get('/Bars/:id', function ($id) { BarsController::onGetBarById($id); }); $app->get('/Bars', function () { BarsController::onGetAllBars(); }); }
<?php header('Content-Type: text/html; charset=UTF-8'); error_reporting(E_ALL); ini_set("display_errors", 'On'); $basedir = realpath(__DIR__); require_once 'Controllers/BarsController.php'; require_once 'Slim/Slim.php'; \Slim\Slim::registerAutoloader(); $app = new \Slim\Slim(); $barsController = new BarsController(); $barsController->RegisterRestUri($app); $app->run();