} }); // ======================= // ======== TEAM ========= // ======================= /** * Lists all teams * method GET * url /teams */ $app->get('/teams', function () { global $user_id; $response = array(); $db = new DbHandler(); // fetching all teams $teamResult = $db->getTeams(); $response["Error"] = false; $response["Teams"] = array(); // looping through result and preparing teams array while ($team = $teamResult->fetch_assoc()) { array_push($response["Teams"], $team); } echoRespnse(200, $response); }); /** * Gets a particular team * method GET * url /teams */ $app->get('/teams/:teamID', function ($teamID) use($app) { $req = $app->request();