2024-09-01 18:54:41 +00:00
|
|
|
<?php
|
|
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . '/config.php');
|
|
|
|
|
2024-09-01 21:56:21 +00:00
|
|
|
// $clean_uri is the request URI with any query strings removed
|
|
|
|
$clean_uri = strtok($_SERVER['REQUEST_URI'], '?');
|
|
|
|
|
2024-09-01 18:54:41 +00:00
|
|
|
// e.g. /api/v1/test/request/ -> ['', 'api', 'v1', 'test', 'request'].
|
|
|
|
// For convenience later, we take a slice that excludes ['', 'api', 'v1'].
|
2024-09-01 21:56:21 +00:00
|
|
|
define('REQUEST_PATH', array_slice(explode('/', $clean_uri), offset: 3));
|
2024-09-01 18:54:41 +00:00
|
|
|
|
|
|
|
switch (REQUEST_PATH[0]) {
|
|
|
|
case 'actor': // /api/v1/actor
|
|
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . '/api/v1/actor.php');
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
http_response_code(404);
|
|
|
|
die();
|
|
|
|
}
|