untuk Protokol Web Modern Masa Kini Membuat Endpoint API dengan FrankenPHP Setelah konfigurasi dasar, kita bisa mulai membuat API sederhana menggunakan FrankenPHP. Buat file index.php: <?php header('Content-Type: application/json'); $routes = [ '/api/hello' => function () { echo ... json_encode(["message" => "Hello, World!"]); }, '/api/status' => function () { echo json_encode(["status" => "API running smoothly"]); } ]; $requestUri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); if (isset($routes[$requestUri])) { $routes[$requestUri](); } else
Tes API
- Home
- Tes API