You are here

public function RequestController::handleRequest in GraphQL 8.3

Same name and namespace in other branches
  1. 8.4 src/Controller/RequestController.php \Drupal\graphql\Controller\RequestController::handleRequest()
  2. 8 src/Controller/RequestController.php \Drupal\graphql\Controller\RequestController::handleRequest()
  3. 8.2 src/Controller/RequestController.php \Drupal\graphql\Controller\RequestController::handleRequest()

Handles graphql requests.

Parameters

string $schema: The name of the schema.

\GraphQL\Server\OperationParams|\GraphQL\Server\OperationParams[] $operations: The graphql operation(s) to execute.

Return value

\Drupal\Core\Cache\CacheableJsonResponse The JSON formatted response.

Throws

\Drupal\Component\Plugin\Exception\PluginException

File

src/Controller/RequestController.php, line 65

Class

RequestController
Handles GraphQL requests.

Namespace

Drupal\graphql\Controller

Code

public function handleRequest($schema, $operations) {
  if (is_array($operations)) {
    return $this
      ->handleBatch($schema, $operations);
  }
  return $this
    ->handleSingle($schema, $operations);
}