Added facebook friends to fb api example

This commit is contained in:
Sahat Yalkabov
2013-12-07 22:50:27 -05:00
parent ab449ae569
commit 4f9d7727c0
2 changed files with 21 additions and 7 deletions

View File

@ -110,17 +110,29 @@ exports.getFacebook = function(req, res) {
}
graph.setAccessToken(token.token);
graph.get('100000588912346', function(err, me) {
console.log(me);
async.parallel({
getMe: function(done) {
graph.get('100000588912346', function(err, me) {
done(err, me);
});
},
getMyFriends: function(done) {
graph.get('100000588912346/friends', function(err, friends) {
done(err, friends.data);
});
}
},
function(err, results) {
res.render('api/facebook', {
title: 'Facebook API',
me: me,
me: results.getMe,
friends: results.getMyFriends,
user: req.user
});
});
};
exports.getScraping = function(req, res) {

View File

@ -21,6 +21,8 @@ block content
h6 Email: #{me.email}
h3.text-primary /me/friends
h4= me.name
h6 Username: #{me.username}
h6 Email: #{me.email}
ul.list
for friend in friends
li
img.img-circle(src='https://graph.facebook.com/#{friend.id}/picture?type=normal', width=30, height=30)
a(href='http://facebook.com/#{friend.id}') #{friend.name}