From 3607d71a40c3efed7b4f61ea5f57acc2227012c1 Mon Sep 17 00:00:00 2001 From: Lars Gebhardt-Kusche Date: Sun, 30 Nov 2025 03:39:16 +0100 Subject: [PATCH] asdasd --- api/index.php | 2 +- api/router/router.v1.php | 29 +++++++++++++++-------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/api/index.php b/api/index.php index 128c074..5f83958 100644 --- a/api/index.php +++ b/api/index.php @@ -3,7 +3,7 @@ // Optional: zentrale Config laden (wenn du magst) declare(strict_types=1); -$apibasedir = $_SERVER['DOCUMENT_ROOT']; +echo $apibasedir = $_SERVER['DOCUMENT_ROOT']; require $apibasedir. '/../config/fileload.php'; // Basis-Header (CORS, JSON) diff --git a/api/router/router.v1.php b/api/router/router.v1.php index 9993f9d..857fc78 100644 --- a/api/router/router.v1.php +++ b/api/router/router.v1.php @@ -1,5 +1,5 @@ false, - 'error' => 'Unknown v1 endpoint', - 'endpoint'=> $endpoint, + 'ok' => false, + 'error' => 'Unknown v1 endpoint', + 'endpoint' => $endpoint, ], JSON_UNESCAPED_UNICODE); return; } @@ -51,7 +53,7 @@ function router_v1_dispatch(array $segments): void echo json_encode([ 'ok' => false, 'error' => 'Endpoint file not found', - 'file' => basename($file), + 'file' => $file, ], JSON_UNESCAPED_UNICODE); return; } @@ -74,16 +76,15 @@ function router_v1_dispatch(array $segments): void // Falls der Handler mal kein Array zurückgibt if (!is_array($result)) { $result = [ - 'ok' => false, - 'error' => 'Handler did not return array', - 'raw' => $result, - 'handler'=> $handler, + 'ok' => false, + 'error' => 'Handler did not return array', + 'raw' => $result, + 'handler' => $handler, ]; } // HTTP-Status aus Ergebnis ableiten (optional) if (isset($result['ok']) && $result['ok'] === false) { - // Bei Fehler eher 400 als 200, außer du willst es anders if (!http_response_code()) { http_response_code(400); }