run the app from public index file

This commit is contained in:
Yisroel Baum 2026-03-22 10:04:14 +02:00
parent 37ff440c16
commit c2ad749b84
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
3 changed files with 34 additions and 0 deletions

18
bootstrap/app.php Normal file
View file

@ -0,0 +1,18 @@
<?php
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use DI\Bridge\Slim\Bridge;
$container = require __DIR__.'/container.php';
$app = Bridge::create($container);
// change first param to false for production
$app->addErrorMiddleware(true, true, true);
$app->get('/', function (Response $response) {
$response->getBody()->write("Hello world!");
return $response;
});
return $app;

9
bootstrap/container.php Normal file
View file

@ -0,0 +1,9 @@
<?php
use DI\Container;
$container = new Container([
]);
return $container;

7
public/index.php Normal file
View file

@ -0,0 +1,7 @@
<?php
require __DIR__ . '/../vendor/autoload.php';
$app = require __DIR__.'/../bootstrap/app.php';
$app->run();