Yep... create a facebook.js and paste this..
var https = require('https');
exports.getFbData = function(accessToken, apiPath, callback) {
var options = {
host: 'graph.facebook.com',
port: 443,
path: apiPath + '?access_token=' + accessToken,
method: 'GET'
};
var buffer = '';
var request = https.get(options, function(result){
result.setEncoding('utf8');
result.on('data', function(chunk){
buffer += chunk;
});
result.on('end', function(){
callback(buffer);
});
});
request.on('error', function(e){
console.log('error from facebook.getFbData: ' + e.message)
});
request.end();
}
.......
Then at your app , place this...
var facebook = require('./facebook.js');
(assuming that your app and the created module is on the same path).
Then, invoke what you want...the example bellow is to get a friends list...
facebook.getFbData(req.params.Auth, '/me/friends/', function(data){
//Code goes here...btw...anyone know how to fetch row by row contained in
the data ? It's returns a json string and I don't know how to use this :(
});
On Tuesday, December 24, 2013 10:24:28 AM UTC-2, Folivi Fofo wrote:
>
> Hi all,
>
>
> does any know a module for facebook?
>
> a sample would be also welcome
>
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.