46 lines
990 B
PHP
46 lines
990 B
PHP
<?php
|
|
|
|
use App\Config;
|
|
use WillySoft\ErrorHandler;
|
|
use WillySoft\Route as App;
|
|
|
|
Config::file_location(
|
|
__DIR__ . '/../config/default.config.php',
|
|
__DIR__ . '/../config/config.php'
|
|
);
|
|
|
|
ErrorHandler::register(function($error_message) {
|
|
view('errors/500', [
|
|
'error_message' => $error_message
|
|
]);
|
|
});
|
|
|
|
use App\Controller\DefaultController;
|
|
|
|
App::get('/',
|
|
DefaultController::index(...));
|
|
App::get('/echo/$text?',
|
|
DefaultController::echo(...));
|
|
App::get('/error',
|
|
DefaultController::error(...));
|
|
|
|
use App\Controller\ChatController;
|
|
|
|
App::group('/chat', function() {
|
|
App::form('/',
|
|
ChatController::index(...));
|
|
App::get('/messages',
|
|
ChatController::messages(...));
|
|
App::get('/sync',
|
|
ChatController::sync(...));
|
|
});
|
|
|
|
App::group('/blog', function() {
|
|
App::get('/',
|
|
fn() => view('pages/blog/home'));
|
|
App::get('/test',
|
|
fn() => view('pages/blog/test'));
|
|
});
|
|
|
|
http_response_code(404);
|
|
view('errors/404'); |