baleen/src/app.php

30 lines
731 B
PHP

<?php declare(strict_types=1);
use Lewisdale\App\Controllers\FeedController;
use Lewisdale\App\Controllers\HomeController;
use Slim\Views\TwigMiddleware;
ini_set('user_agent', 'Baleen/1.0 (https://baleen.lewisdale.dev)');
require_once __DIR__ . "/dependencies.php";
global $container;
global $app;
$dotenv = Dotenv\Dotenv::createImmutable([__DIR__, __DIR__ . "/.."]);
$dotenv->safeLoad();
require_once __DIR__ . "/session.php";
$app->add(TwigMiddleware::createFromContainer($app));
$app->add('csrf');
$app->get("/", [HomeController::class, 'get']);
$app->get('/feed', [FeedController::class, 'get']);
$app->get('/feed/{id}', [FeedController::class, 'get_feed']);
$app->addErrorMiddleware(true, true, true);
$app->run();