21 lines
542 B
PHP
21 lines
542 B
PHP
<?php
|
|
// Namespaces
|
|
use Pecee\SimpleRouter\SimpleRouter;
|
|
use Pecee\Http\Request;
|
|
// Error handling redirects
|
|
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']);
|