Slim API deployment - composer install + full CRUD endpoints

This commit is contained in:
Hermes Agent
2026-05-20 14:36:05 +02:00
parent 48bf9c7088
commit 8ab4e532fd
1727 changed files with 7746 additions and 7 deletions

36
api/public/index.php Normal file
View File

@@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
require __DIR__ . '/../vendor/autoload.php';
use App\Config\Container;
// Load .env file safely
$envFile = __DIR__ . '/../.env';
if (file_exists($envFile)) {
$dotenv = new \Symfony\Component\Dotenv\Dotenv();
$dotenv->load($envFile);
}
// Boot Eloquent BEFORE creating the app
Container::boot();
$container = Container::build();
\Slim\Factory\AppFactory::setContainer($container);
$app = \Slim\Factory\AppFactory::create();
// CORS Middleware
$app->add(new \Tuupola\Middleware\CorsMiddleware([
'origin' => ['https://fahrschultermin.de', 'https://www.fahrschultermin.de'],
'methods' => ['GET', 'POST', 'PATCH', 'DELETE', 'OPTIONS'],
'headers.allow' => ['Content-Type', 'Authorization', 'X-Requested-With'],
'credentials' => true,
'cache.maxage' => 86400,
]));
// Routes
(require __DIR__ . '/../src/Routes/api.php')($app);
$app->run();