<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('log_errors', 1);

require_once __DIR__ . '/vendor/autoload.php';

$f3 = Base::instance();

$f3->set('DEBUG', 3);
$f3->set('UI', __DIR__ . '/app/views/');
$f3->set('AUTOLOAD', __DIR__ . '/app/controllers/;' . __DIR__ . '/app/models/');
$f3->set('CACHE', false);

$basePath = rtrim(dirname($_SERVER['SCRIPT_NAME']), '/');
$f3->set('BASE', $basePath);
$f3->set('BASE_PATH', $basePath);
$f3->set('ASSET_PATH', $basePath . '/assets');

session_start();

try {
    require_once __DIR__ . '/app/config/db.php';
} catch (Exception $e) {
    die("Database Error: " . $e->getMessage());
}

require_once __DIR__ . '/app/routes.php';

$f3->run();
