Setup Slim application in /demo
This commit is contained in:
parent
dff258b6af
commit
278c87b237
5 changed files with 30 additions and 2 deletions
|
@ -6,7 +6,7 @@ First iteration is only to server files.
|
|||
To be able to extend the functionality, these files will first be served from `/f/`.
|
||||
|
||||
The code should be written to be used as a PHP module, as well as, a separate site.
|
||||
The [Slim](https://www.slimframework.com/) provides for the latter.
|
||||
The [Slim](https://www.slimframework.com/) provides for the latter in `./demo`.
|
||||
|
||||
The visibility of files is toggled by a file in each directory -- `.hippoacl`,
|
||||
working somewhat like a `.gitignore` file. [^1]
|
||||
|
|
|
@ -14,5 +14,9 @@
|
|||
"email": "dev@etdeboone.nl"
|
||||
}
|
||||
],
|
||||
"require": {}
|
||||
"require": {},
|
||||
"require-dev": {
|
||||
"slim/slim": "4.*",
|
||||
"slim/psr7": "^1.6"
|
||||
}
|
||||
}
|
||||
|
|
2
demo/.gitignore
vendored
Normal file
2
demo/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
/vendor/
|
||||
/composer.lock
|
0
files/.gitignore → demo/files/.gitignore
vendored
0
files/.gitignore → demo/files/.gitignore
vendored
22
demo/index.php
Normal file
22
demo/index.php
Normal 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();
|
Loading…
Reference in a new issue