setBasePath(get_public_path() . "/api"); $tacticEndpoint = new TacticEndpoint(new TacticModel(new TacticInfoGateway($con))); $router->map("POST", "/tactic/[i:id]/edit/name", fn(int $id) => $tacticEndpoint->updateName($id)); $router->map("GET", "/tactic/[i:id]", fn(int $id) => $tacticEndpoint->getTacticInfo($id)); $router->map("POST", "/tactic/new", fn() => $tacticEndpoint->newTactic()); $match = $router->match(); if ($match == null) { echo "404 not found"; header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); exit(1); } header('Content-type: application/json'); call_user_func_array($match['target'], $match['params']);