website/public/API/graphql.php

30 lines
667 B
PHP
Raw Normal View History

2022-03-08 09:54:38 +01:00
<?php
2022-04-07 09:24:06 +02:00
use GraphQL\Server\StandardServer;
2022-03-08 09:54:38 +01:00
use GraphQL\Type\Schema;
2022-04-16 23:34:35 +02:00
use GraphQL\Error\DebugFlag;
2022-03-08 09:54:38 +01:00
require 'vendor/autoload.php';
require "./lib/config.php";
require "./lib/mysql.php";
require "./queries/queries.php";
$schema = new Schema([
2022-04-07 09:24:06 +02:00
'query' => $queryType,
'mutation' => $mutationType,
2022-03-08 09:54:38 +01:00
]);
try {
$serverConfig = [
'schema' => $schema,
'rootValue' => [
'db' =>$conn,
2022-04-16 23:34:35 +02:00
],
'debugFlag' => DebugFlag::INCLUDE_DEBUG_MESSAGE | DebugFlag::INCLUDE_TRACE,
2022-03-08 09:54:38 +01:00
];
$server = new StandardServer($serverConfig);
$server->handleRequest();
} catch (Throwable $error) {
StandardServer::send500Error($error);
2022-03-08 09:54:38 +01:00
}