aboutsummaryrefslogtreecommitdiff
path: root/index.php
blob: c38567debbd7be919c60ad84f23c09fb473aeaa0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php

declare(strict_types=1);

namespace AugustOffensive;

require_once "autoload.php";

use AugustOffensive\View;
use AugustOffensive\Controller;

// configure content type before anything is output
header("Content-Type: application/" . View\Main::TYPE);

try {
    // initiate connection and build front-end
    $connection = Controller\Controller::initiateConnection();
    $view = new View\Main($connection);

    // get results of query from front-end
    $result = $view->generateResult();

    echo $result;
} catch (\Exception $err) {
    // catch all exceptions and let the controller generate the error
    $error = Controller\Controller::errorResult($err);

    // pass generated error result to output
    echo View\Main::generateOutput($error);
}