router = new HttpFx; $this->router->use('/', fn($resp) => $resp->setPoweredBy('Seria')); } public function getRouter(): IRouter { return $this->router; } public function registerDefaultErrorPages(): void { $this->router->setDefaultErrorHandler($this->defaultErrorHandler(...)); $this->router->addErrorHandler(500, fn($resp) => $resp->setContent(file_get_contents(SERIA_DIR_TEMPLATES . '/500.html'))); } public function defaultErrorHandler( HttpResponseBuilder $responseBuilder, HttpRequest $request, int $code, string $message ): void { // todo: render using templating $responseBuilder->setTypeHTML(); $responseBuilder->setContent(sprintf( '%1$03d %2$s

%1$03d %2$s


Seria
', $code, $message )); } public function register(IRouteHandler $handler): void { $this->router->register($handler); } public function dispatch(?HttpRequest $request = null): void { $this->router->dispatch($request); } }