Initial commit

This commit is contained in:
Blaise de Carné
2018-04-24 15:25:06 +02:00
commit d38f28bd07
18 changed files with 41921 additions and 0 deletions

26
docker/app/www/index.php Normal file
View File

@ -0,0 +1,26 @@
<?php
//define('SERVER', 'sparql'); # switch resolver to pure sparql
header('Access-Control-Allow-Credentials: true', true);
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Content-Type');
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
return;
}
if (isset($_SERVER['CONTENT_TYPE']) && $_SERVER['CONTENT_TYPE'] === 'application/json') {
$rawBody = file_get_contents('php://input');
$requestData = json_decode($rawBody ?: '', true);
} else {
$requestData = $_POST;
}
$payload = isset($requestData['query']) ? $requestData['query'] : null;
require_once __DIR__.'/../vendor/autoload.php';
$processor = \Datatourisme\Api\DatatourismeApi::create('http://blazegraph:9999/blazegraph/namespace/kb/sparql');
$response = $processor->process($payload);
header('Content-Type: application/json');
echo json_encode($response);
exit;