public function add($route, $params = '', $methods = 'GET|HEAD', $middleware = '')
    {
        // Convert the route to a regular expression: escape forward slashes
        $route = preg_replace('/\//', '\\/', $route);
        // Convert variables e.g. {controller}
        $route = preg_replace('/\{([a-z]+)\}/', '(?P<\1>[a-z-]+)', $route);
        // Convert variables with custom regular expressions e.g. {id:\d+}
        $route = preg_replace('/\{([a-z]+):([^\}]+)\}/', '(?P<\1>\2)', $route);
        // Add start and end delimiters, and case insensitive flag
        $route = '/^'.$route.'$/i';

        //If array
        if (is_array($params)) {
            $methodArray = ['method' => $methods];
            $params = array_merge($params, $methodArray);
            $this->routes[$route] = $params;
        } elseif (is_string($params)) {
            //If string
            $param = [];
            $parts = explode('@', $params);
            $param['controller'] = $parts[0];
            $param['action'] = $parts[1];
            $param['method'] = $methods;
            if (isset($parts[2])) {
                $param['namespace'] = $parts[2];
            }
            //If middleware is set then used
            (!empty($middleware)) ? $param['middleware'] = $this->addMiddleware($middleware) : $param;
            $this->routes[$route] = $param;
        } elseif (is_callable($params)) {
            (!empty($middleware)) ? $this->routes[$route] = ['callable' => $params, 'method' => $methods, 'middleware' => $this->addMiddleware($middleware)] : $this->routes[$route] = ['callable' => $params, 'method' => $methods];
        } else {
            throw new \Exception('Wrong agruments given', 500);
        }
    }