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);