Exemple #1
0
    $users = $user->buildProfile($id);
    $users[0]['user_num_friends'] = $friends->getNumberOfFriends($id);
    echo json_encode($users);
});
//just for Testing
$app->get('/12345', function () use($app, $post) {
    var_dump($post->getComments("1"));
});
$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;