willy.club/routes/start.php

37 lines
769 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(...));
});
http_response_code(404);
view('errors/404');