PHP-Course/exam/routes/routes.php
2024-07-20 14:04:08 +02:00

22 lines
520 B
PHP

<?php
// Namespaces
use Pecee\SimpleRouter\SimpleRouter;
use Pecee\Http\Request;
/*
SimpleRouter::error(function (Request $request, \Exception $exception) {
switch ($exception->getCode()) {
// Page not found
case 404:
redirect('/phpCourse/exam/not-found', 404);
}
});
*/
//404
SimpleRouter::get('/not-found', [Pages\NotFound\NotFound::class, "render"]);
//Index
SimpleRouter::get('/', function () {
return 'Hello world';
});
//API
SimpleRouter::get("/api/login", [Api\Login\Login::class, 'post']);