Files
skeleton/www/api.example.com/public/index.php
Worker Skeletton 9d798bab78 Rename example domains to generic scheme
Use example.com instead of domain.de/game references to make
the skeleton truly generic and not tied to any specific project.
2026-05-25 13:48:03 +02:00

18 lines
529 B
PHP

<?php
/**
* api.example.com — REST API
*/
header('Content-Type: application/json');
$method = $_SERVER['REQUEST_METHOD'];
switch ($method) {
case 'GET':
echo json_encode(['status' => 'ok', 'message' => 'API läuft']);
break;
case 'POST':
$input = json_decode(file_get_contents('php://input'), true);
echo json_encode(['status' => 'received', 'data' => $input]);
break;
default:
http_response_code(405);
echo json_encode(['error' => 'Method not allowed']);
}