website/public/API/graphql.php

29 lines
667 B
PHP

<?php
use GraphQL\Server\StandardServer;
use GraphQL\Type\Schema;
use GraphQL\Error\DebugFlag;
require 'vendor/autoload.php';
require "./lib/config.php";
require "./lib/mysql.php";
require "./queries/queries.php";
$schema = new Schema([
'query' => $queryType,
'mutation' => $mutationType,
]);
try {
$serverConfig = [
'schema' => $schema,
'rootValue' => [
'db' =>$conn,
],
'debugFlag' => DebugFlag::INCLUDE_DEBUG_MESSAGE | DebugFlag::INCLUDE_TRACE,
];
$server = new StandardServer($serverConfig);
$server->handleRequest();
} catch (Throwable $error) {
StandardServer::send500Error($error);
}