private function route(RequestInterface $request): ?Route
    {
        $routes = $this->match($request);

        if (empty($routes)) {
            throw new Exception('No route found', Exception::HTTP_NOT_FOUND);
        }

        $route = $this->guard($request, $routes);

        if (empty($route)) {
            throw new Exception('Method not allowed', Exception::HTTP_METHOD_NOT_ALLOWED);
        }

        $route = $this->overlay($route);

        foreach (array_reverse($this->namespaces) as $namespace) {
            $route['namespace'] = $namespace;

            try {
                return new Route(
                    $route['namespace'],
                    $route['module'],
                    $route['controller'],
                    $route['action'],
                    $route['parameters']
                );
            } catch (Exception $e) {
                continue;
            }
        }

        throw new Exception('Invalid controller/action for this route', Exception::HTTP_INTERNAL_SERVER_ERROR);
    }