2023-02-03 11:00:13 +00:00
|
|
|
<?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(...));
|
2023-02-03 11:01:55 +00:00
|
|
|
App::get('/sync',
|
|
|
|
ChatController::sync(...));
|
2023-02-03 11:00:13 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
http_response_code(404);
|
|
|
|
view('errors/404');
|