<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);



//phpinfo();
//die('done');
session_start();

ini_set('default_charset', 'UTF-8');

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: X-Requested-With, Content-Type,Accept, MOBILE-AUTHORIZATION-TOKEN, SESSION-AUTHORIZATION-TOKEN, DEVICE-ID');
header("Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS, HEAD");
header('Access-Control-Allow-Credentials: true');

if ($_SERVER['REQUEST_METHOD']=='OPTIONS') {
    header("HTTP/1.1 200 OK");
    die();
}

//these are included in order of operation - do not change!
include_once('../app/includes/configuration.php');
include_once('../vendor/autoload.php');
include_once('../app/includes/init.php');
include_once('../app/includes/bootstrap.php');
 
//echo $httpRequest->getRequestParams()->getYmlKey();
//pr( $httpRequest->getNodeConfig());
use Gossamer\Core\System\Kernel;

$kernel = new Kernel($container, $container->get('Logger'), $httpRequest, $httpResponse);

$kernel->run();

super_unset($kernel);
super_unset($container);

if (session_id() !== '') {
    session_destroy();
}
