<?php

use Dotenv\Dotenv;
use lib\Configs\Route;

require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . "/lib/Configs/Route.php";
try {
  $dotenv = Dotenv::createImmutable(__DIR__);
  $dotenv->load();
  // 테스트 URL : "http://test.com/Control/Method/arg1/arg2";
  // 요청된 URL 경로 가져오기
  $url = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : false;
  // $url = !$url && isset($argv[1]) ? $argv[1] : false;
  $route = new Route(trim($url, '/'));
  return $route->run();
} catch (\Exception $e) {
  echo $e->getMessage();
}
