This commit is contained in:
Bruno Eckhardt committed 2026-05-22 12:24:06 +02:00
1 parent bfd16c310d
commit 9d0863d65f
1 file changed
+12 -11
+12 -11
View File
@@ -845,7 +845,7 @@ use MVC\Core\Controller;
use MVC\Classes\Api;
class ApiController extends Controller {
public static function (){
public static function get(){
return Api::jsonResponse([
'data' => 'DummyData',
]);
@@ -913,15 +913,11 @@ class TestController extends Controller {
}
PHP;
// --- VIEWS ---
$files['WEBROOT/src/MVC/View/home.php'] = "<h1>Dashboard</h1><p>Willkommen in deinem neuen MVC-System mit integriertem Header.</p>";
$files['WEBROOT/src/MVC/View/test1.php'] = "<h1>Service 1</h1><p><?= \$msg ?></p>";
$files['WEBROOT/src/MVC/View/test2.php'] = "<h1>System Check</h1><ul><?php foreach(\$data as \$k => \$v): ?><li><b><?= \$k ?>:</b> <?= \$v ?></li><?php endforeach; ?></ul>";
// --- API ---
$files['WEBROOT/api/v1/get.php'] = <<<'PHP
$files['WEBROOT/api/v1/get.php'] = <<<'PHP'
<?php
header('Content-Type: application/json');
require_once __DIR__ . '/../../src/MVC/autoloader.php';
use MVC\Controller\ApiController;
@@ -929,13 +925,18 @@ use MVC\Controller\ApiController;
$api = (new ApiController());
try {
Api::jsonResponse($api->get());
catch (\Exception $e) {
Api::jsonResponse(§e->getMessage(), 404);
echo ($api->get());
} catch (\Exception $e) {
echo ($e->getMessage());
}
PHP;
// --- VIEWS ---
$files['WEBROOT/src/MVC/View/home.php'] = "<h1>Dashboard</h1><p>Willkommen in deinem neuen MVC-System mit integriertem Header.</p>";
$files['WEBROOT/src/MVC/View/test1.php'] = "<h1>Service 1</h1><p><?= \$msg ?></p>";
$files['WEBROOT/src/MVC/View/test2.php'] = "<h1>System Check</h1><ul><?php foreach(\$data as \$k => \$v): ?><li><b><?= \$k ?>:</b> <?= \$v ?></li><?php endforeach; ?></ul>";
// --- ENTRY POINT ---
$files['WEBROOT/index.php'] = <<<'PHP'
<?php