public function api($match, $apiController, $kwargs = [], $methods = null)
    {
        if (is_string($methods)) {
            $methods = array($methods);
        }
        if (! is_array($kwargs)) { // @codeCoverageIgnore
            $kwargs = []; // @codeCoverageIgnore
        }
        if ($methods === null) {
            $methods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'];
        }

        $methods = array_map('strtoupper', $methods);

        if ($match === '') { // @codeCoverageIgnore
            throw new RouterException('Your API route must contain a first match field when registering!'); // @codeCoverageIgnore
        }
        if (substr($match, 0, 1) !== '/') {
            $match = '/' . $match;
        }

        foreach ($methods as $method) {
            switch ($method)
            {
                case 'GET':
                    $this->get($match, $apiController, array_merge($kwargs, ['api_method' => 'list']));
                    $this->get($match . '/(!?)', $apiController, array_merge($kwargs, ['api_method' => 'retrieve']));
                    break;
                case 'POST':
                    $this->post($match, $apiController, array_merge($kwargs, ['api_method' => 'create']));
                    break;
                case 'PUT':
                    $this->put($match . '/(!?)', $apiController, array_merge($kwargs, ['api_method' => 'update']));
                    break;
                case 'PATCH':
                    $this->patch($match . '/(!?)', $apiController, array_merge($kwargs, ['api_method' => 'partialUpdate']));
                    break;
                case 'DELETE':
                    $this->delete($match . '/(!?)', $apiController, array_merge($kwargs, ['api_method' => 'destroy']));
                    break;
            }
        }
    }