diff --git a/composer.json b/composer.json index 4f49a40..c37f18b 100644 --- a/composer.json +++ b/composer.json @@ -5,12 +5,13 @@ "require": {}, "autoload": { "psr-4": { - "MyCodebox\\MariaCore\\": "src/" + "MyCodebox\\MariaCore\\": "src/", + "App\\Controller\\": "example/app/Controller/" } }, "scripts": { "dump": "composer dump-autoload", - "serve": "php -S localhost:8080 -t public" + "serve": "php -S localhost:8080 -t example/public" }, "config": { "sort-packages": true, diff --git a/src/Controller/HelloController.php b/example/app/Controller/HelloController.php similarity index 88% rename from src/Controller/HelloController.php rename to example/app/Controller/HelloController.php index 49991ac..abd28e8 100644 --- a/src/Controller/HelloController.php +++ b/example/app/Controller/HelloController.php @@ -1,6 +1,6 @@ get('/', function (Request $request, array $params) { return (new Response())->withHtml('

Willkommen auf der Startseite!

'); }); -$router->get('/routes', [$routeController, 'json']); -$router->get('/routes.html', [$routeController, 'html']); +$router->get('/routes', [$routesController, 'json']); + + + +$router->get('/routes.html', [$routesController, 'html']); + $router->get('/protected', function (Request $request, array $params) { return (new Response())->withJson(['message' => 'Du bist authentifiziert!']);