Move existing code exactly to config file

The directory structure is taken from zendframework/zend-expressive-skeleton.
This commit is contained in:
Adrian 2016-10-25 00:23:03 +02:00
parent 0f2f3ac00b
commit 4ba3a3ffdb
2 changed files with 15 additions and 6 deletions
config/autoload
public

View file

@ -0,0 +1,13 @@
<?php return [
'middleware_pipeline' => [
Zend\Expressive\Container\ApplicationFactory::ROUTING_MIDDLEWARE,
Zend\Expressive\Container\ApplicationFactory::DISPATCH_MIDDLEWARE,
],
'routes' => [
[
'path' => '/',
'middleware' => function ($req, $res, $next) { $res->getBody()->write("Hello World!"); },
'allowed_methods' => [ 'GET' ],
],
],
];

View file

@ -9,14 +9,10 @@ require_once 'vendor/autoload.php';
$c = new Container;
$c['config'] = new ArrayObject(require 'config/autoload/full.global.php');
$c[Application::class] = new ApplicationFactory;
$app = $c[Application::class];
$app->get('/', function ($req, $res, $next) {
$res->getBody()->write("Hello World!");
});
$app->pipeRoutingMiddleware();
$app->pipeDispatchMiddleware();
$app->run();