run the app from public index file
This commit is contained in:
parent
37ff440c16
commit
c2ad749b84
3 changed files with 34 additions and 0 deletions
18
bootstrap/app.php
Normal file
18
bootstrap/app.php
Normal 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
9
bootstrap/container.php
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use DI\Container;
|
||||||
|
|
||||||
|
$container = new Container([
|
||||||
|
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $container;
|
||||||
7
public/index.php
Normal file
7
public/index.php
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require __DIR__ . '/../vendor/autoload.php';
|
||||||
|
|
||||||
|
$app = require __DIR__.'/../bootstrap/app.php';
|
||||||
|
|
||||||
|
$app->run();
|
||||||
Loading…
Add table
Add a link
Reference in a new issue