website/public/API/graphql.php

28 lines
553 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;
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-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
}