Пример #1
0
$app->get('/friends/rndSix', function () use($friends) {
    $sixPack = $friends->getSixRndFriends($_SESSION['user_id']);
    echo json_encode($sixPack);
});
//checks if you're friends with user
$app->get('/checkfriendstatus/:id', function ($id) {
    global $friends;
    echo json_encode($friends->checkIfFriends($id));
});
$app->post('/sendfriendrequest', function () {
    global $app, $friends;
    echo $friends->sendFriendRequest($app->request->getBody());
});
$app->post('/acceptfriendrequest', function () {
    global $app, $friends;
    echo $friends->acceptFriendRequest($app->request->getBody());
});
$app->delete('/rejecttfriendrequest', function () {
    global $app, $friends;
    echo $friends->rejectFriendRequest($app->request->getBody());
});
$app->delete('/unfriend', function () {
    global $app, $friends;
    echo $friends->unFriend($app->request->getBody());
});
$app->delete('/comment/delete/:post_id', function ($post_id) use($post) {
    echo $post->deletePost($post_id);
});
$app->get('/check/:id', function ($id) use($post) {
});
$app->run();