summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/app.php6
-rw-r--r--config/routes.php14
2 files changed, 18 insertions, 2 deletions
diff --git a/config/app.php b/config/app.php
index 6278f193..9af35eb4 100644
--- a/config/app.php
+++ b/config/app.php
@@ -15,13 +15,15 @@ return [
\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)));
+});