Files
surikov/mirzaev/surikovlib/system/public/index.php
2022-10-13 07:07:04 +03:00

50 lines
1.9 KiB
PHP

<?php
declare(strict_types=1);
namespace mirzaev\surikovlib;
use mirzaev\minimal\core;
use mirzaev\minimal\router;
define('VIEWS', realpath('..' . DIRECTORY_SEPARATOR . 'views'));
define('STORAGE', realpath('..' . DIRECTORY_SEPARATOR . 'storage'));
define('TYPE', 'mysql');
define('BASE', 'surikovlib');
define('HOST', '127.0.0.1');
define('LOGIN', 'root');
define('PASSWORD', 'sUrikov_topchik_228!');
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
// Автозагрузка
require __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
// Инициализация маршрутазитора
$router = new router;
// Запись маршрутов
$router->write('/', 'main', 'index');
$router->write('/account/registration', 'accounts', 'registration', 'POST');
$router->write('/account/authentication', 'accounts', 'authentication', 'POST');
$router->write('/account/deauthentication', 'accounts', 'deauthentication', 'POST');
$router->write('/account/deauthentication', 'accounts', 'deauthentication', 'GET');
$router->write('/books', 'books', 'index', 'GET');
$router->write('/books/$id', 'books', 'index', 'GET');
$router->write('/books/$id/$page', 'books', 'index', 'GET');
$router->write('/books/$id/$page/rotate', 'books', 'rotate', 'POST');
$router->write('/books/$id/delete', 'books', 'delete', 'POST');
$router->write('/storage/books/$id/$file', 'books', 'read', 'GET');
$router->write('/storage/books/write', 'books', 'write', 'POST');
$router->write('/kemenov', 'kemenov', 'index', 'GET');
$router->write('/surikov', 'surikov', 'index', 'GET');
$router->write('/contacts', 'contacts', 'index', 'GET');
// Инициализация ядра
$core = new core(namespace: __NAMESPACE__, router: $router);
// Обработка запроса
echo $core->start();