16 lines
479 B
PHP
16 lines
479 B
PHP
|
<?php
|
||
|
require_once($_SERVER['DOCUMENT_ROOT'] . '/config.php');
|
||
|
|
||
|
// e.g. /api/v1/test/request/ -> ['', 'api', 'v1', 'test', 'request'].
|
||
|
// For convenience later, we take a slice that excludes ['', 'api', 'v1'].
|
||
|
define('REQUEST_PATH', array_slice(explode('/', $_SERVER['REQUEST_URI']), offset: 3));
|
||
|
|
||
|
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();
|
||
|
}
|