$app->get('/posts', function () { $db = new dbHandler(); $cur = $db->getAllPost(); $result = array(); foreach ($cur as $doc) { $tmp = array(); $tmp["title"] = $doc["title"]; $tmp["post"] = $doc["post"]; $tmp["date"] = date('Y-m-d', strtotime('+7 hours', $doc["date"]->sec)); array_push($result, $tmp); } response(200, $result); }); $app->get('/info', function () { $db = new dbHandler(); $cur = $db->getInfoPost(); $result = array(); foreach ($cur as $doc) { $tmp = array(); $tmp["title"] = $doc["title"]; $tmp["post"] = $doc["post"]; $tmp["date"] = date('Y-m-d', strtotime('+7 hours', $doc["date"]->sec)); array_push($result, $tmp); } response(200, $result); }); $app->get('/scholar', function () { $db = new dbHandler(); $cur = $db->getScholarPost(); $result = array(); foreach ($cur as $doc) {