private function initEvents()
    {
        $this->router->on('NotFound', function($request, $response) {
            $response
                ->setStatus(404)
                ->write('Not found')
                ->end();
        });

        $this->router->on('error', function ($request, $response, $error) {
            $response
                ->reset()
                ->setStatus(500)
                ->write($error)
                ->end();
        });
    }