<?php

declare(strict_types=1);

use GalpaoImperial\Api\Database;
use GalpaoImperial\Api\SiteRepository;
use function GalpaoImperial\Api\corsPreflight;
use function GalpaoImperial\Api\ensureMethod;
use function GalpaoImperial\Api\jsonResponse;

corsPreflight($method);
ensureMethod('GET', $method);

$repository = new SiteRepository(Database::connection());

jsonResponse([
    'success' => true,
    'data' => $repository->bootstrap(),
]);
