fix initial files after test

This commit is contained in:
dwindown
2025-08-30 14:36:00 +07:00
parent 7417021bb0
commit ce001bf9ce
3 changed files with 203 additions and 27 deletions

View File

@@ -1,27 +0,0 @@
<?php
// public/index.php — tiny router
require __DIR__.'/../app/bootstrap.php';
require __DIR__.'/../app/helpers/cors.php';
$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) ?: '/';
// CORS preflight
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') { cors_preflight(); exit; }
// Routes (v1)
if ($path === '/v1/emojis') { require __DIR__.'/../app/controllers/Emojis.php'; exit; }
if (preg_match('#^/v1/emoji/([^/]+)$#', $path)) { $_GET['slug'] = urldecode($GLOBALS['matches'][1] ?? $GLOBALS['1'] ?? ''); require __DIR__.'/../app/controllers/Emojis.php'; exit; }
if ($path === '/v1/license/activate') { require __DIR__.'/../app/controllers/License.php'; exit; }
if ($path === '/v1/license/verify') { require __DIR__.'/../app/controllers/License.php'; exit; }
if ($path === '/v1/license/deactivate') { require __DIR__.'/../app/controllers/License.php'; exit; }
// Health
if ($path === '/v1/health') {
header('Content-Type: application/json; charset=utf-8');
echo json_encode(['ok'=>true,'time'=>gmdate('c')]);
exit;
}
http_response_code(404);
header('Content-Type: application/json; charset=utf-8');
echo json_encode(['error'=>'not_found','path'=>$path]);