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;
|
|
|
|
|
|
|
|
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 {
|
2022-04-05 10:26:18 +02:00
|
|
|
$serverConfig = [
|
|
|
|
'schema' => $schema,
|
|
|
|
'rootValue' => [
|
|
|
|
'db' =>$conn,
|
2022-03-08 09:54:38 +01:00
|
|
|
]
|
|
|
|
];
|
2022-04-05 10:26:18 +02:00
|
|
|
$server = new StandardServer($serverConfig);
|
|
|
|
|
|
|
|
$server->handleRequest();
|
|
|
|
} catch (Throwable $error) {
|
|
|
|
StandardServer::send500Error($error);
|
2022-03-08 09:54:38 +01:00
|
|
|
}
|