summaryrefslogtreecommitdiff
path: root/public/create/index.php
blob: 00ce79477da8a33eb1b6a5c482f551bf56fe1e33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php

declare(strict_types=1);

use DTS\Bookmark;
use DTS\Template;
use function DTS\Functions\respondAndExit;

require_once(__DIR__.'/../../autoload.php');

$config = require_once(__DIR__.'/../../config.php');

if (filter_input(INPUT_SERVER, 'REQUEST_METHOD') !== 'GET') {
    respondAndExit(405, 'Method Not Allowed');
}

$template = new Template($config['path_to_templates']);

$bookmark = new Bookmark();

$html = $template->render('create', compact('bookmark'));

respondAndExit(200, 'OK', $html);