diff options
author | msquare <msquare@notrademark.de> | 2018-09-07 20:50:31 +0200 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2018-09-07 20:50:31 +0200 |
commit | 2d6bca1357faff28bc1f86a56b432cc463ff7574 (patch) | |
tree | ce18461d2e170ac28dd365342a1f125a8a31aa3a /config | |
parent | b320fc779063ee80b8f0ba505cb323287ccccbf5 (diff) | |
parent | ce6d0fd13b54ac79a955b85d50860736a520d333 (diff) |
Merge branch 'MyIgel-routing'
Diffstat (limited to 'config')
-rw-r--r-- | config/app.php | 8 | ||||
-rw-r--r-- | config/routes.php | 14 |
2 files changed, 19 insertions, 3 deletions
diff --git a/config/app.php b/config/app.php index bb405fde..9af35eb4 100644 --- a/config/app.php +++ b/config/app.php @@ -8,20 +8,22 @@ return [ \Engelsystem\Logger\LoggerServiceProvider::class, \Engelsystem\Exceptions\ExceptionsServiceProvider::class, \Engelsystem\Config\ConfigServiceProvider::class, - \Engelsystem\Routing\RoutingServiceProvider::class, + \Engelsystem\Http\UrlGeneratorServiceProvider::class, \Engelsystem\Renderer\RendererServiceProvider::class, \Engelsystem\Database\DatabaseServiceProvider::class, \Engelsystem\Http\RequestServiceProvider::class, \Engelsystem\Http\SessionServiceProvider::class, \Engelsystem\Http\ResponseServiceProvider::class, \Engelsystem\Http\Psr7ServiceProvider::class, + \Engelsystem\Middleware\RouteDispatcherServiceProvider::class, + \Engelsystem\Middleware\RequestHandlerServiceProvider::class, ], // Application middleware 'middleware' => [ \Engelsystem\Middleware\SendResponseHandler::class, \Engelsystem\Middleware\ExceptionHandler::class, - \Engelsystem\Middleware\LegacyMiddleware::class, - \Engelsystem\Middleware\NotFoundResponse::class, + \Engelsystem\Middleware\RouteDispatcher::class, + \Engelsystem\Middleware\RequestHandler::class, ], ]; diff --git a/config/routes.php b/config/routes.php new file mode 100644 index 00000000..5296dbc7 --- /dev/null +++ b/config/routes.php @@ -0,0 +1,14 @@ +<?php + +use FastRoute\RouteCollector; +use Psr\Http\Message\ServerRequestInterface; + +/** @var RouteCollector $route */ + +/** Demo route endpoint, TODO: Remove */ +$route->addRoute('GET', '/hello/{name}', function ($request) { + /** @var ServerRequestInterface $request */ + $name = $request->getAttribute('name'); + + return response(sprintf('Hello %s!', htmlspecialchars($name))); +}); |