Setup Slim application in /demo

This commit is contained in:
Eric-Teunis de Boone 2024-01-08 01:21:23 +01:00
parent dff258b6af
commit 278c87b237
5 changed files with 30 additions and 2 deletions

22
demo/index.php Normal file
View file

@ -0,0 +1,22 @@
<?php
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Factory\AppFactory;
require __DIR__ . '/../vendor/autoload.php';
$app = AppFactory::create();
$app->addErrorMiddleware(False, False, False);
$app->get('/', function (Request $request, Response $response, $args) {
$response->getBody()->write("Hello world!");
return $response;
});
$app->get('/f/{path:.*}', function (Request $request, Response $response, array $args) {
$response->getBody()->write("Requesting " . $args['path']);
return $response;
});
$app->run();