bd
This commit is contained in:
14
index.php
Normal file → Executable file
14
index.php
Normal file → Executable file
@ -2,18 +2,26 @@
|
||||
ini_set("display_errors", 1);
|
||||
error_reporting(-1);
|
||||
|
||||
const ROOT_PATH = __DIR__;
|
||||
const VIEW_PATH = __DIR__ . "/views";
|
||||
const VIEW_CACHE_PATH = __DIR__ . "/compilation_cache";
|
||||
|
||||
require_once "vendor/autoload.php";
|
||||
|
||||
require_once "bootstrap/db.php";
|
||||
|
||||
use Phroute\Phroute\RouteCollector;
|
||||
|
||||
$router = new RouteCollector();
|
||||
|
||||
$router->get('/', [\itguild\forms\app\controllers\Main::class, 'indexAction']);
|
||||
$router->get('/example', [\itguild\forms\app\controllers\Main::class, 'exampleAction']);
|
||||
|
||||
$router->get('/', [\itguild\forms\app\controllers\MainController::class, 'indexAction']);
|
||||
$router->get('/example', [\itguild\forms\app\controllers\MainController::class, 'exampleAction']);
|
||||
$router->get('/create-user', [\itguild\forms\app\controllers\UserController::class, 'createUserAction']);
|
||||
$router->get('/get-user/{id}', [\itguild\forms\app\controllers\UserController::class, 'getUserAction']);
|
||||
$dispatcher = new Phroute\Phroute\Dispatcher($router->getData());
|
||||
|
||||
$response = $dispatcher->dispatch($_SERVER['REQUEST_METHOD'], parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
|
||||
|
||||
|
||||
// Print out the value returned from the dispatched function
|
||||
echo $response;
|
Reference in New Issue
Block a user