Closed KitsuneDev closed 1 year ago
use bluebird to "promisify" the graph calls and use Promises instead of callbacks!
Or using Async await
functions
Like @Twisterking said, use bluebird
to promisify fbgraph
, then all methods will have their promisified async method with the Async
suffix:
const Promise = require('bluebird'),
graph = Promise.promisifyAll(require('fbgraph'));
graph.setVersion('2.11');
graph.setOptions({...some options...});
async function getFeed(page_id) {
const feed = await graph.getAsync(`/${page_id}/feed`);
}
Thanks @ffflabs your solution helped a lot.
Hey guys, sorry, I'm new to NodeJS. Is there any way to await for a post call??