41 lines
1.5 KiB
PHP
41 lines
1.5 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', '..' . DIRECTORY_SEPARATOR . 'storage');
|
|
define('TYPE', 'mysql');
|
|
define('BASE', 'surikovlib');
|
|
define('HOST', '127.0.0.1');
|
|
define('LOGIN', 'root');
|
|
define('PASSWORD', '');
|
|
|
|
// Автозагрузка
|
|
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/cover', 'books', 'cover', 'GET');
|
|
$router->write('/books/$id/0', 'books', 'cover', 'GET');
|
|
$router->write('/books/write', 'books', 'write', 'POST');
|
|
|
|
// Инициализация ядра
|
|
$core = new core(namespace: __NAMESPACE__, router: $router);
|
|
|
|
// Обработка запроса
|
|
echo $core->start();
|