diff --git a/public_html/.htaccess b/public_html/.htaccess new file mode 100644 index 00000000..29176dc6 --- /dev/null +++ b/public_html/.htaccess @@ -0,0 +1,2 @@ +RewriteEngine On +RewriteRule ^/?api/(.*) api-dispatch.php?q=$1 [L] diff --git a/public_html/api-dispatch.php b/public_html/api-dispatch.php new file mode 100644 index 00000000..371615ec --- /dev/null +++ b/public_html/api-dispatch.php @@ -0,0 +1,25 @@ +handle($_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI']); +} +catch (\Exception $e) +{ + $json = [ + 'error' => $e->getMessage(), + 'trace' => $e->getTrace(), + ]; +} + +header('Content-Type: application/json'); +echo json_encode($json); diff --git a/src/Controllers/AbstractController.php b/src/Controllers/AbstractController.php new file mode 100644 index 00000000..717f3031 --- /dev/null +++ b/src/Controllers/AbstractController.php @@ -0,0 +1,10 @@ +post('/api/login', [$this, 'login']); + $router->get('/api/login', [$this, 'login']); + } + + public function login() + { + } +}